Java 8 was released in 18th March 2014, we will discuss here Java 8 features with examples. Java 8 Features 1. forEach() method in Iterable interface Whenever we need to traverse through a Collection, we need to create an Iterator whose whole purpose is to iterate over and then we have business logic in a loop for each of the elements in the Collection. We might get ConcurrentModificationException if iterator is not used properly. Java 8 has introduced forEach method in java.lang.Iterable interface so that while writing code we focus on business logic only. forEach method takes java.util.function.Consumer object as argument, so it helps in having our business logic at a separate location that we can reuse. Let’s see forEach usage with simple example. package com.journaldev.java8.foreach; import java.util.ArrayList; import java.util.Iterator; import java.util.L...