Created
February 15, 2017 18:26
-
-
Save spot62/af5dfef74c5f23f96e0f876bf062f502 to your computer and use it in GitHub Desktop.
Java8 Lambda
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
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