创建一个从0开始一直加3的流5位
Stream<Integer> stream2 = Stream.iterate(0, (x) -> x + 3).limit(5);
stream2.forEach(System.out::println);
stream流网址
https://blog.csdn.net/mu_wind/article/details/109516995?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522164628573216780265496162%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=164628573216780265496162&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_ecpm_v1~rank_v31_ecpm-7-109516995.pc_search_result_cache&utm_term=stream%E6%B5%81&spm=1018.2226.3001.4187
List<Integer> list = Arrays.asList(7, 6, 9, 3, 8, 2, 1);
// 遍历输出符合条件的元素
list.stream().filter(x -> x > 6).forEach(System.out::println);
// 匹配第一个
Optional<Integer> findFirst = list.stream().filter(x -> x > 6).findFirst();
// 匹配任意(