Why is List.sort method encrypted?

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).

enter image description here

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

0
source share
1 answer

Use an Iterable Type Version Instead

Due to obsolescence - check out the docs . Some of the sort methods are deprecated in favor of others.

+1
source

Source: https://habr.com/ru/post/1203613/


All Articles