1、基本介紹
1、創(chuàng)建方式
1、Array的Stream創(chuàng)建
1、直接創(chuàng)建
// mainStream stream = Stream.of("a", "b", "c"); String [] strArray = new String[] {"a", "b", "c"}; stream = Stream.of(strArray);
// Stream.of()@SafeVarargs@SuppressWarnings("varargs") // Creating a stream from an array is safepublic static<T> Stream<T> of(T... values) { return Arrays.stream(values); }
2、直接使用Arrays.stream工具創(chuàng)建
// mainString [] strArray = new String[] {"a", "b", "c"}; stream = Arrays.stream(strArray);