Java8 forEach loop

Java8 forEach loop example

forEach Signature forEach(Consumer<? super T> action) Working :Performs the provided action for each element of the Iterable until all elements have been processed or the action throws an exception.Your code gives hint about what should be iterated.The internal implementation of forEach determines how to iterate it.This is delegation we don’t write the implementation we used…

Read More Read More

Stream() Java8

Hi Guys, We will have a look at powerful functionality in java8. Stream vs Collection Streams: Takes advantage of declarative programming it gives hint about what operations need to perform on source. Collection: It has direct access on source (array, collections). You will need to take care of iteration. What is Stream? Stream is composed of the Stream pipeline. Stream=Source+Intermediary…

Read More Read More

Java8 Part2 Streams

Java8 StreamsThe Java conventional style to deal with collection is external iteration.We deal with collection by Internal iteration External iteration The term external iteration implies you need to explicitly take care of iteration of elements in collection then validate each element and add it to the other list. Where as internal iteration implies.Java8 itself gives capability to iterate each and…

Read More Read More

java8 lambda

Lambda Expressions   What is lambda Expressions?                   The lambda expression is just like the function it consist of List of parameters Method Body return Type Lambda Expression termed as anonymous because it does not have any name. Lambda Expression passed as arguments to the methods.     Anatomy of Lambda expression 🙂…

Read More Read More