Skip to content

Instantly share code, notes, and snippets.

@spot62
Created February 15, 2017 18:26
Show Gist options
  • Save spot62/af5dfef74c5f23f96e0f876bf062f502 to your computer and use it in GitHub Desktop.
Save spot62/af5dfef74c5f23f96e0f876bf062f502 to your computer and use it in GitHub Desktop.
Java8 Lambda
public static void main(String[] args) {
Operationable operation;
operation = (x,y)->x+y;
int result = operation.calculate(10, 20);
}
public class LambdaApp {
public static void main(String[] args) {
Operationable op = new Operationable(){
public int calculate(int x, int y){
return x + y;
}
};
int z = op.calculate(20, 10);
}
}
interface Operationable{
int calculate(int x, int y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment