java - Ordering results from Collections.frequency -


i have got arraylist 500+ words in. i'm trying organise them list word appears @ top , 2nd frequent , on.

so far i've managed filter out words frequency of less 5 code below cannot work out how can organise these results list of frequencies in descending order.

    set<string> unique = new hashset<string>(wordsl);      (string key : unique) {       if (collections.frequency(wordsl, key) > 5) { //        println(collections.frequency(wordsl, key));         lwords.add(key);         println(lwords);       }     } 

thanks in advance help.

you can use map<string, integer> counting.

you can later sort map value.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -