Java 8 for loop

Posted on Posted in Core Java, Java 8

For loop in Java has changed a lot from the way it first appeared in jdk 1.   Here is an example of the classical for loop :  

  Java 5 added the forEach loop that made looping with collections easier as it removed declaration of the looping variable and checking length of […]

Java 8 Lambda expressions

Posted on 1 CommentPosted in Java, Java 8

What is Lambda expression in Java ? A Lambda expression represents an Anonymous function. Anonymous method concept is similar to that of an Anonymous class… the difference being it implements a functional interface. Functional interface is a new interface concept in Java 8. A functional interface can only declare one abstract method. Lambda expressions allow […]

Java 8 interface new features

Posted on 1 CommentPosted in Java, Java 8

Default interface methods Prior to Java 8, an Interface could only have public abstract methods.   The implementing class for this interface was supposed to provided implementation for each of the abstract methods or declare itself as abstract.   With Java 8, an Interface can also contain public default methods with concrete implementations.   An […]