top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

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

+2 votes
33 views

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 Google+ Share Button LinkedIn Share Button Multiple Social 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:
http://www.programcreek.com/2014/01/why-stream-maxintegermax-compile/

answer Mar 14, 2016 by Shivam Kumar Pandey
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...