Campbell Ritchie wrote:Since you are calling a getPurifiedTitle() method, it must be the purifies/sanitised title, not the original.
must Janik wrote:. . . it is saving original title or the purified
Piet Souris wrote:Is that purified title strong enough to base the 'equals' method on it?
But to make a frequencymap, you do not need to override 'equals'. Assuming your Book class has a method 'String getPurifiedTitle', then a frequencymap of two Book lists can be made like:
Campbell Ritchie wrote:As I said, I think your book class wants an equals() method, and the other things that go with equals(), so you can define equality, so your books “toj est”, “tojest”, and, “to jest” count as the same. Then, maybe, combine the two Lists and stream the combined List.Remember, it will only work if you have overridden equals(), etc, correctly. I am not joking.
Campbell Ritchie wrote:Probably not. But what I think you should do is give a good explanation of why you are using that particular structure.
must Janik wrote:. . . you think I should create another entity class?
You will only know that when you have explained what you are going to use them for.
Campbell Ritchie wrote:And when you have a book in the Economics category about changing currencies, “Forex - Ample”, what then?
Campbell Ritchie wrote:I think you are trying to do too much all at once. Look at the length of your method names. Line 81, “for example”, and that isn't even the longest. What if you want twenty book titles, or you add “SciFi” as a book category? Why are you using so many methods with similar names when you could pass the category as an argument? Why are you using Strings for categories when you could create an enum?
Campbell Ritchie wrote:
I think you should divide that task into small parts. Start by creating a book title class with some sort of equals() method with a proper algorithm to compare titles.
Later: Please explain what you are doing with all the Lists and Maps. Have you got the right data structures?