//使用stream来遍历 ArrayList<String> arrayList = new ArrayList<String>(); //或 stream.forEach(System.out::println); |
// parallelStream来遍历集合 并行流会使用多线程 ArrayList<String> arrayList = new ArrayList<String>(); |
//arrays 创建流 String [] str ={"11111","22222","33333"}; |
//of方法 String [] str ={"11111","22222","33333"}; Stream<Integer> stream = Stream.of(1, 2, 3, 4, 5, 6, 7); |
// iterate 创建流 //从0开始,每次增加2个 取前5个数据进行输出 |
//取前5个随机数据进行输出 |
// IntStream LongStream DoubleStream IntStream intStream = IntStream.of(1, 2, 3, 4); //输出0-50 IntStream LongStream DoubleStream 的of range rangeClosed |
Tools-stream遍历
最新推荐文章于 2024-04-24 11:50:29 发布