1 创建方式一:collection
@Test
public void testCreatStreamFromCollection(){
List<String> strings = Arrays.asList("java", "python", "html", "javascript");
strings.stream().forEach(System.out::println);
}
2 创建方式二
@Test
public void testCreatStreamFromValues(){
Stream<String> stream = Stream.<String>of("java", "python", "html", "javascript");
stream.forEach(System.out::println);
}
3 创建方式三
@Test
public void testCreatStreamFromArray(){
Stream<String> stream = Arrays.stream(new String[]{"java", "python", "html", "javascript"});
stream.forEach(System.out::println);
}