0

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

enter image description here

Why? Is that method deperecated? If so, what is the correct way to sort a list in Groovy?

Glory to Russia
  • 17,289
  • 56
  • 182
  • 325

1 Answers1

1

Use the Iterable version of sort instead

Because of deprecation - have a look at the docs. Some of sort methods are deprecated in favor of others.

Opal
  • 81,889
  • 28
  • 189
  • 210