Why Stream.max(Integer::max) compiles in Java?
Answers
Answered by
3
The reason why the code above compiles is in the way of how the new lambda functionality works in Java 8. It relies on a concept which is informally known as "single abstract method (SAM)" interfaces. ... Autoboxing allows this to appear as a Comparator in a method context. Therefore, Math::max is accepted.
Similar questions