Skip to content

Instantly share code, notes, and snippets.

@dlhartveld
Last active July 17, 2022 18:53
Show Gist options
  • Save dlhartveld/5056695 to your computer and use it in GitHub Desktop.
Save dlhartveld/5056695 to your computer and use it in GitHub Desktop.
Example Java 8 lambda expression: concatenation of two strings. The first version explicitly defines types and a method body. The second version omits these. It uses implicit typing for its parameters, and lacks the return statement.
java.util.function.BiFunction<String, String, String> concat1
= (String s, String t) -> {
return s + t;
};
java.util.function.BiFunction<String, String, String> concat2
= (s, t) -> s + t;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment