Easiest Way to Sort a List of Words by Occurance

前端 未结 6 2047
南方客
南方客 2021-01-22 09:12

What is the best/easiest way to sort a large list of words (10,000-20,000) by the number of times they occur in the list, in Java. I tried a basic implementation but I get an ou

6条回答
  •  佛祖请我去吃肉
    2021-01-22 09:53

    The Multiset is what you are looking from google collections. That data structure is exactly built to support your use cases. All you need to do is populate it with your words. It will maintain the frequency for you

提交回复
热议问题