// Sort the vocab hashmap according to tf.
VocabFrequencyPair[] entries = new VocabFrequencyPair[vocab.size()];
int entryNum = 0;
for (Entry<String, Integer> entry : vocab.entrySet()) {
entries[entryNum++] = new VocabFrequencyPair(entry.getKey(), entry.getValue());
}
Arrays.sort(entries);
return new TfDoclengthStatistics(entries, tfs, doclens);
}