Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

string array to stream

// import java.util.Arrays;
// import java.util.stream.Stream;

String[] array = {"a", "b", "c", "d", "e"};

//Arrays.stream
Stream<String> stream1 = Arrays.stream(array);
stream1.forEach(x -> System.out.println(x));

//Stream.of
Stream<String> stream2 = Stream.of(array);
stream2.forEach(x -> System.out.println(x));
Source by mkyong.com #
 
PREVIOUS NEXT
Tagged: #string #array #stream
ADD COMMENT
Topic
Name
6+7 =