bagOfEntries.add(entryBuilder);
}
//make a map with values - count and keys - string and sort by frequency
Map<String, Integer> frequentWords = new <String, Integer>HashMap();
for (String pattern : bagOfEntries.uniqueSet()) {
frequentWords.put(pattern, bagOfEntries.getCount(pattern));
}
Map.Entry<String, Integer>[] entries = frequentWords.entrySet().toArray(new Map.Entry[0]);
Arrays.sort(entries, new Comparator<Map.Entry<String, Integer>>() {
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {