mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add methods
This commit is contained in:
parent
6f97c9ed42
commit
440e3ebc2a
@ -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(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user