/** * Exposes efficient method for accessing values in this map. */ public LongCollection values() { return counts.values(); }
public long id() { return ids.values().iterator().nextLong(); }
public void load(File file) throws IOException, ClassNotFoundException { ObjectInputStream in = new ObjectInputStream(new FileInputStream(file)); freqDist = (Object2LongOpenHashMap<T>) in.readObject(); in.close(); int samples = 0; LongIterator sampleIter = freqDist.values().iterator(); // determine total frequency while (sampleIter.hasNext()) { long count = sampleIter.next(); samples += count; } n = samples; // determine max sample for (T key : freqDist.keySet()) { Long freq = freqDist.get(key); if (freq > maxFreq) { maxFreq = freq; maxSample = key; } } }