arrays.stream in java code example
Example 1: create stream from array java
// creating stream from array
int[] arr = {1, 2, 3, 4};
Arrays.stream(arr);
Stream.of(arr); // same as above
Example 2: loop array using stream java
int[] ns = new int[] {1,2,3,4,5};
int[] ms = Arrays.stream(ns).map(n -> n * 2).filter(n -> n % 4 == 0).toArray();