Optional Keyword – Java 8

Java 8 has introduced java.util.Optional class to find a value present or absent. Normally Java developers do “not null” check to identify whether the Object is null or to be used further for business logic. In a Enterprise application, lot of null checks present as each meaning object is checked, which makes the code messy. … Continue reading “Optional Keyword – 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 … Continue reading “Streams”

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. … Continue reading “Lambda Expressions”