Java 8 – Method references
With Lambda expressions Java 8 has new power for developing smart and fast applications. If you don’t know how lambda expressions works just take a look a link above. Sometimes, there is already a method that carries out exactly the action that you’d like to pass on to some other code. For example, suppose you simply want to print the event object whenever a button is clicked. You can use code below:
1 2 |
button.setOnAction(event -> System.out.println(event)); |
[…]