Created
November 13, 2017 14:25
-
-
Save bitlather/b3f389c1e49d3b0869e141370a6c3e61 to your computer and use it in GitHub Desktop.
This file contains 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 class Lambda { // requires >= java 1.8 | |
interface IntegerMath { | |
int operation(int a, int b); | |
default IntegerMath swap() { | |
return (a, b) -> operation(b, a); | |
} | |
} | |
public static void main(String[] args) { | |
IntegerMath addition = (a, b) -> a + b; | |
System.out.println(addition.operation(40, 2)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment