可以用stream.of来合并两个流
public class Test7concat {public static void main(String[] args) {/*Stream流:static <T> Stream<T> concat(Stream<? extends T> a, Stream<? extends T> b);合并2个流中的元素*/Stream<String> stream1 = Stream.of("jack", "rose");Stream<String> stream2 = Stream.of("18", "19");// 合并Stream.concat(stream1,stream2).forEach(str-> System.out.println(str));}
}