The purpose of this exercise is to learn how to use Map collections.
Duration: 45 minutes
In this task, you will calculate how often each word occurs in a text and get the corresponding statistics. Omit all words that contain fewer than four letters and appear fewer than 10 times (words that are too small or rare).
Please proceed to the Words
class and provide the implementations of the countWords()
method, which returns the statistics as a String containing entries in the form "word - amount\n"
.
- The input parameter is a list of strings representing lines of text.
- The entries in the resulting String should also be sorted by descending frequency of words and then in alphabetical order if necessary.
- Make sure your code can handle texts in English and other languages.
You may not use streams, lambdas, or method references in your code.