Skip to content

Instantly share code, notes, and snippets.

@d-smith
Created April 30, 2016 15:08
Show Gist options
  • Save d-smith/d8343723f6b732e39621ce8189090c98 to your computer and use it in GitHub Desktop.
Save d-smith/d8343723f6b732e39621ce8189090c98 to your computer and use it in GitHub Desktop.
Lambda Expressions
//Executed at http://www.tutorialspoint.com/compile_java8_online.php
public class HelloWorld{
public static void main(String []args){
System.out.println("Hello World");
java.util.function.Function<Integer,Integer> times2 = (Integer x) -> 2*x;
java.util.function.Function<Integer,java.util.function.Function<Integer,Integer>> timesN = x -> y -> x * y;
System.out.println(times2.apply(2));
System.out.println(timesN.apply(2).apply(3));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment