Java TreeMap sort by values comparator – why does this throw ClassCastException
I have a treemap with some strings and the frequencies of those strings.
I want to sort based on the frequencies, therefore I decided to write a custom comparator.
What is wrong with this piece of code? It throws an exception.
Java TreeMap sort by values comparator – why does this throw ClassCastException
I have a treemap with some strings and the frequencies of those strings.
I want to sort based on the frequencies, therefore I decided to write a custom comparator.
What is wrong with this piece of code? It throws an exception.