I have a map of errors and the number of their occurrences in some situation. I want to have a list, which contains that information in order of descending number of errors (i. e. the most frequent error is first element, the second-most - the second etc.).
I wrote following code:
List<Map.Entry<String,Integer>> entryList = new ArrayList<>(errors.entrySet());
entryList.sort{a, b -> b.value <=> a.value}
It works fine, but the sort
is striked through (in Eclipse IDE with the Groovy plugin).
Why? Is that method deperecated? If so, what is the correct way to sort a list in Groovy?