package com.shrimpking.t3;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
/**
* Created by IntelliJ IDEA.
*
* @Author : Shrimpking
* @create 2024/9/11 18:18
*/
public class ThirdReduceStream
{
public static void main(String[] args)
{
List<Integer> list = Arrays.asList(1,2,3,4);
Stream<Integer> stream = list.stream();
String result = stream.reduce("string:",
(str,i) -> str + i,
(str,i) -> str + "hello");
System.out.println(result);
}
}
09-09
559
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-06
252
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)