The method sort(int[]) in the type Arrays is not applicable for the arguments (int[], Collections.re

时间:2024-03-22 08:13:15

The method sort(int[]) in the type Arrays is not applicable for the arguments (int[], Collections.reverseOrder())

Java中Arrays.sort()增加Comparator时,需要注意传入数组的格式

不能够使用int声明的数组,必须使用Integer声明的数组

例如The method sort(int[]) in the type Arrays is not applicable for the arguments (int[], Collections.re

 

如果直接使用int创建的数组就会报错

The method sort(int[]) in the type Arrays is not applicable for the arguments (int[], Collections.re