//利用Stream.of方法创建流
Stream<String> stream = Stream.of("hello", "world", "Java8");
stream.forEach(System.out::println);
System.out.println("##################");
//利用Stream.iterate方法创建流
//长度为5的集合 10 11 12 13 14
Stream.iterate(10, n -> n + 1)
.limit(5)
.collect(Collectors.toList())
.forEach(System.out::println);
System.out.println("##################");//10 11 12 13 14
//利用Stream.generate方法创建流
//长度为个随机数
Stream.generate(Math::random).limit(5).forEach(System.out::println);
System.out.println("##################");
//从现有的集合中创建流
List<String> strings = Arrays.asList("hello", "world", "Java8");
String string = strings.stream().collect(Collectors.joining(","));
System.out.println(string);