Stream#max(Comparator)
takes a Comparator
. You'll want to use Integer#compare(int, int)
as that comparison function.
list.stream().max(Integer::compare).get()
You were providing Integer#max(int, int)
as an implementation of Comparator#compare(int, int)
. That method doesn't match the requirements of Comparator#compare
. Instead of returning a value indicating which is biggest, it returns the value of the biggest.