You never specify the
result type of a lambda expression. It is always inferred from context. Method References
button.setOnAction(System.out::println);
Arrays.sort(strings, String::compareToIgnoreCase)
Constructor References
Button[] buttons = stream.toArray(Button[]::new);
Static Methods in Interfaces
As of Java 8, you are allowed to add static methods to interfaces. There was never a technical reason why this should be outlawed: It simply seemed to be against the spirit of interfaces as abstract specifications.
Read full article from Lambda Expressions in Java 8 | Dr Dobb's
No comments:
Post a Comment