Quantcast
Viewing all articles
Browse latest Browse all 11

Most frequent n – words in java ArrayList

I need to find the most frequent words (n words, so if n = 5, the most frequent 5 words) in an ArrayList. private ArrayList<String> wordList = new ArrayList<String>(); public ArrayList<String> mostOften(int k) { ArrayList<String> lista = new ArrayList<String>(); Set<String> unique = new HashSet<String>(wordList); for (String key : unique) System.out.println(key + ": " + Collections.frequency(wordList, […]

The post Most frequent n – words in java ArrayList appeared first on BlogoSfera.


Viewing all articles
Browse latest Browse all 11

Trending Articles