I have a map of errors and the number of cases in a certain situation. I want to have a list that contains this information in descending order of the number of errors (that is, the most common error is the first element, the second is the second, etc.).
I wrote the following code:
List<Map.Entry<String,Integer>> entryList = new ArrayList<>(errors.entrySet()); entryList.sort{a, b -> b.value <=> a.value}
It works fine, but sort encrypted (in the Eclipse IDE with the Groovy plugin).

Why? Is this method canceled? If so, what is the correct way to sort the list in Groovy?
source share