int frequency = mReader.docFreq(term); // DF
frequencyMap.put(term, frequency);
}
// sort the term map by frequency descending
Ordering descOrder = new Ordering<Map.Entry<Term,Integer>>() {
public int compare(Map.Entry<Term,Integer> left, Map.Entry<Term,Integer> right) {
return Ints.compare(right.getValue(), left.getValue());
}
};
List<Map.Entry<Term,Integer>> sorted = descOrder.sortedCopy(frequencyMap.entrySet());
return sorted;
}