Java 8 stream max() function argument type Comparator vs Comparable
问题 I wrote some simple code like below. This class works fine without any errors. public class Test { public static void main(String[] args) { List<Integer> intList = IntStream.of(1,2,3,4,5,6,7,8,9,10).boxed().collect(Collectors.toList()); int value = intList.stream().max(Integer::compareTo).get(); //int value = intList.stream().max(<Comparator<? super T> comparator type should pass here>).get(); System.out.println("value :"+value); } } As the code comment shows the max() method should pass an