top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Why Stream.max(Integer::max) compiles in Java?

+2 votes

Why is Math::max acceptable while it's apparently not a Comparator

posted Aug 25, 2015 by Karthick.c

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

It relies on a concept which is informally known as "single abstract method (SAM)" interfaces. The basic idea is that any interface with one abstract method can be automatically implemented by any lambda or method reference, if the lambda or method reference matches the SAM in the interface.go to through the following for more detail:

answer Mar 14, 2016 by Shivam Kumar Pandey
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.