Java 8

Features of Java 8


1.Overview Streams are introduced in Java in Stream API to handle the operations on the list of elements in functional programming approach. Using Streams we can do multiple operations on the list of elements. We can do filtering(Filter) or ordering (Map) etc., on the list of elements/collections in the stream. Second is we can do …

Streams Read More »

forEach Expression

Starting Java 8, a new method forEach is introduced to iterate the elements. This forEach(Consumer<? super T> action) method is created in the following interfaces in java. java.lang.Iterable java.util.Stream This method performs a user given action on each element. In the below example, we can iterate a list of collections with forEach defining a condition.  


Lambda Expressions

Lambda expression is a Java 8 feature, which helps the developer to simplify syntax of anonymous interface implementation whenever required. Interface is defined anonymously in earlier Java Implementation in the below old syntax., which is very much reduced in Java 8 lambda implementation, comparison of the below example provide a clear view of Lambda expression. …

Lambda Expressions Read More »