We would like to know how to convert Array to Stream.
/* ww w. jav a 2 s. com*/ import java.util.Arrays; import java.util.stream.Stream; public class Main { public static void main(String[] argv) { Stream.of("This", "is", "Java8", "Stream").forEach(System.out::println); String[] stringArray = new String[]{"Streams", "can", "be", "created", "from", "arrays"}; Arrays.stream(stringArray).forEach(System.out::println); } }
The code above generates the following result.