someone can help me with code? How to search in text file any word and count how many it were repeated?
For example test.txt:
hi
hola
hey
hi
bye
hoola
hi
And if I want to know how many times are repeated in test.txt word "Hi" program must say "3 times repeated"
I hope you understood what I want, thank you for answers.
Use
MultiSet
collection from google guava library.You can read text file line by line. I assume that each line can contain more than one word. For each line, you call: