Skip to content

Instantly share code, notes, and snippets.

@Artemas-Muzanenhamo
Last active February 22, 2018 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Artemas-Muzanenhamo/3d73945ea2bc0b1614ff6f427b984412 to your computer and use it in GitHub Desktop.
Save Artemas-Muzanenhamo/3d73945ea2bc0b1614ff6f427b984412 to your computer and use it in GitHub Desktop.
This is a simple gist to show the minimal requirements to create a lambda in Java 8+
/**
* Lambdas require a Functional Interface and
* a target method
*
*/
public class Example {
public static void main(String[] args) {
Summation summation = (a, b) -> a + b;
System.out.println(summation.sum(3, 4));
}
}
@FunctionalInterface
interface Summation {
// target method
int sum(int n, int m);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment