This is my code
List ints = Stream.of(1,2,4,3,5).collect(Collectors.toList()); Integer maxInt = ints.stream()
Comparator.comparing expects a function which maps the source object to the value which actually gets compared - in your case, as you don't want to pre-process the value to be compared, i is simply mapped to itself.
Comparator.comparing
i