Last active
August 29, 2015 14:13
-
-
Save philipschwarz/0d3497b7484e89984e9c to your computer and use it in GitHub Desktop.
tasting the lambda syntactic sugar that the Java 8 Compiler lets you write in place of an instance of a required functional interface
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
IntStream.of(1, 2, 3).forEach( new IntConsumer() { public void accept(int value) { System.out.println(value); } } ); | |
IntStream.of(1, 2, 3).forEach( new IntConsumer() { public void accept(int n) { System.out.println(n); } } ); | |
IntStream.of(1, 2, 3).forEach( (int n) -> { System.out.println(n); } ); | |
IntStream.of(1, 2, 3).forEach( (int n) -> System.out.println(n) ); | |
IntStream.of(1, 2, 3).forEach( n -> System.out.println(n) ); | |
IntStream.of(1, 2, 3).forEach( System.out::println ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment