📜  要流式传输的字符串数组 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:06.154000             🧑  作者: Mango

代码示例1
// import java.util.Arrays;
// import java.util.stream.Stream;

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

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

//Stream.of
Stream stream2 = Stream.of(array);
stream2.forEach(x -> System.out.println(x));