public void putAll(LongObjectMap <V> dic) { if (dic.isEmpty()) { return; } long[] keys = dic.getKeys(); V[] values = dic.getValues(); long fv = dic.getFreeValue(); long k; for (int i = keys.Length - 1; i >= 0; --i) { if ((k = keys[i]) != fv) { put(k, values[i]); } } }
/** 在字典中找寻最小的 */ public static long findLeastOfDic <T>(LongObjectMap <T> dic, Comparison <T> compare) { long[] keys = dic.getKeys(); T[] values = dic.getValues(); long fv = dic.getFreeValue(); long k; T v; T temp = default(T); bool has = false; long re = -1; for (int i = keys.Length - 1; i >= 0; --i) { if ((k = keys[i]) != fv) { v = values[i]; if (!has) { has = true; temp = v; re = k; } else { if (compare(temp, v) < 0) { temp = v; re = k; } } } } return(re); }