Tag: foreach

  • Java 8 – forEach loop statement examples

    The for-each construct gets rid of the clutter and the opportunity for error. Java 8 has introduced a new way to loop over a List or Collection, by using the forEach() method of the new Stream class. You can iterate over any Collection e.g. List, Set, or Map by converting them into a java.util.sttream.Stream instance.…