Inspectopedia
 
2024.3

'Collections.sort()' can be replaced with 'List.sort()'

Warning
New
Last modified: 03 December 2024

Reports calls of Collections.sort(list, comparator) which can be replaced with list.sort(comparator).

Collections.sort is just a wrapper, so it is better to use an instance method directly.

This inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8.