add methods

This commit is contained in:
Looly 2022-07-05 22:59:49 +08:00
parent 6f97c9ed42
commit 440e3ebc2a

View File

@ -20,7 +20,7 @@ public class CollectorUtilTest {
@Test
public void reduceListMapTest() {
Set<Map<String, Integer>> nameScoreMapList = StreamUtil.of(
final Set<Map<String, Integer>> nameScoreMapList = StreamUtil.of(
// 集合内的第一个map包含两个key value
MapUtil.builder("苏格拉底", 1).put("特拉叙马霍斯", 3).build(),
MapUtil.of("苏格拉底", 2),
@ -28,7 +28,7 @@ public class CollectorUtilTest {
MapUtil.of("特拉叙马霍斯", 2)
).collect(Collectors.toSet());
// 执行聚合
Map<String, List<Integer>> nameScoresMap = nameScoreMapList.stream().collect(CollectorUtil.reduceListMap());
final Map<String, List<Integer>> nameScoresMap = nameScoreMapList.stream().collect(CollectorUtil.reduceListMap());
Assert.assertEquals(MapUtil.builder("苏格拉底", Arrays.asList(1, 2))
.put("特拉叙马霍斯", Arrays.asList(3, 1, 2)).build(),