How to iterate over an array using Java Streams
Iterate over an array using Java Streams
String[] myArray = new String[] {"first", "second", "third", "fourth", "fifth"}
Stream.of(myArray).forEach(<<YOUR LOGIC HERE>>);
Printing elements in an array using Java Streams
This stream using a lambda function in the forEach loop to print the element.
String[] myArray = new String[] {"first", "second", "third", "fourth", "fifth"}
Stream.of(myArray).forEach(element -> System.out.println(element));
// This prints:
first
second
third
fourth
fifth