Created
August 14, 2013 04:14
-
-
Save vaskoz/6227954 to your computer and use it in GitHub Desktop.
Java 8 Method Reference examples from JLS 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System::getProperty | |
String::length | |
List<String>::size // explicit class type args | |
List::size // inferred class type args, or generic | |
int[]::clone | |
T::tvarMember | |
"abc"::length | |
foo[x]::bar | |
(test ? list.map(String::length) : Collections.emptyList())::iterator | |
super::toString | |
String::valueOf // overload resolution needed | |
Arrays::sort // type args (if any) inferred from context | |
Arrays::<String>sort // explicit type args | |
ArrayList<String>::new // constructor for parameterized type | |
ArrayList::new // inferred class type args, or generic | |
Foo::<Integer>new // explicit generic constructor type arguments | |
Bar<String>::<Integer>new // generic class, generic constructor | |
Outer.Inner::new // inner class constructor | |
int[]::new // array "constructor" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment