Java examples for Lambda Stream:Lambda
A lambda expression is an anonymous block of code containing statements and returns a result.
public class Main { public static void main(String[] args) { // Invoke the lambda, passing a parameter named "text" to the // hello() method, returning the string HelloType helloLambda = (String text) -> { System.out.println("Hello " + text); };/* ww w .j a v a2 s . com*/ // Invoke the method call helloLambda.hello("Lambda"); } } /** * Functional Interface */ interface HelloType { /** * Function that will be implemented within the lambda * * @param text */ void hello(String text); }