Last active
November 26, 2019 07:50
-
-
Save chao2zhang/3cb92ddf079dd1f368ec306d0963cbdc 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
// JavaApp.java | |
private boolean isEven(int id) { | |
return id % 2 == 0; | |
} | |
public boolean invokeJavaSam(int id, JavaSam sam) { | |
return sam.apply(id); | |
} | |
private void useJavaSam() { | |
JavaSam javaSam = id -> id % 2 == 0; | |
invokeJavaSam(3, id -> id % 2 == 0); | |
invokeJavaSam(4, this::isEven); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment