Error
The method sort(Comparator<? super [Integer]>) in the type List<[Integer]> is not applicable for the arguments ()
Error Type
Compile Time ( Java 8 )
Sample Code
List<Integer> intList = new ArrayList<Integer>();
intList.add(6);
intList.add(5);
intList.sort();
Cause
The method sort expects the argument of the type Comparator.
Possible Resolution
Specify the Comparator using Lambda Expression
List<Integer> intList = new ArrayList<Integer>();
intList.add(6);
intList.add(5);
intList.sort((i,j)->i.compareTo(j));
or Specify null for natural order sorting.
List<Integer> intList = new ArrayList<Integer>();
intList.add(6);
intList.add(5);
intList.sort(null);
The method sort(Comparator<? super [Integer]>) in the type List<[Integer]> is not applicable for the arguments ()
Error Type
Compile Time ( Java 8 )
Sample Code
List<Integer> intList = new ArrayList<Integer>();
intList.add(6);
intList.add(5);
intList.sort();
Cause
The method sort expects the argument of the type Comparator.
Possible Resolution
Specify the Comparator using Lambda Expression
List<Integer> intList = new ArrayList<Integer>();
intList.add(6);
intList.add(5);
intList.sort((i,j)->i.compareTo(j));
or Specify null for natural order sorting.
List<Integer> intList = new ArrayList<Integer>();
intList.add(6);
intList.add(5);
intList.sort(null);