Answers for "create string [] to stream"

3

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));
Posted by: Guest on July-17-2020
0

string to stream java

String testString = "String";
IntStream intStream = testString.chars();
Posted by: Guest on January-30-2022

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language