Java examples for Lambda Stream:Method Reference
Create Comparator via method reference
import java.util.Arrays; import java.util.Comparator; import java.util.List; public class Main { public static void main(String[] args) { List<String> list = Arrays.asList("1", "4", "2"); list.forEach(System.out::println); Comparator<String> t = Comparator.comparing(String::length); }/* w ww .jav a 2 s . c o m*/ }