= Java8 = Has many improvments like added support for functional programming, added new date time API and the new stream API similar to LINQ queries in C# (map/reduce). == Lambda expressions examples == {{{#!highlight java /* javac LambdaExpressionTest.java java -cp . LambdaExpressionTest */ public class LambdaExpressionTest{ public static void main(String[] args){ System.out.println("LambdaExpressionTest"); // define implementation // (lambda parameters) -> { // lambda body }; TestIt testIt = (stuffx) -> System.out.println("Stuff " + stuffx); testIt.sayStuff("Msg"); // change lambda function implementation testIt = (stuffxx) -> { stuffxx = stuffxx.toUpperCase(); System.out.println("OtherStuff " + stuffxx); }; testIt.sayStuff("Msg"); } // lambda expressions require interfaces to define the expected parameters public interface TestIt{ void sayStuff(String stuff); } } }}} == Method reference examples == {{{#!highlight java /* Usage of :: to refer to a method. Similar in concept to function pointers/callbacks javac MethodReferenceExample.java ASD.java java -cp . MethodReferenceExample Interface Consumer Functional interface and can therefore be used as the assignment target for a lambda expression or method reference. */ import java.util.ArrayList; public class MethodReferenceExample{ public static void main(String[] args){ System.out.println("MethodReferenceExample"); ArrayList al = new ArrayList(); al.add("Str1"); al.add("Str2"); al.add("Str3"); //For each string in the array list call println having as argument the item al.forEach(System.out::println); ASD dummy = new ASD(); al.forEach(dummy::showStuff); } } }}} {{{#!highlight java public class ASD{ public ASD(){ } public void showStuff(String message){ System.out.println("Show stuff " + message); } } }}}