diff --git a/hutool-core/src/main/java/org/dromara/hutool/core/stream/CollectorUtil.java b/hutool-core/src/main/java/org/dromara/hutool/core/stream/CollectorUtil.java index 41aa67921..4c62590d2 100644 --- a/hutool-core/src/main/java/org/dromara/hutool/core/stream/CollectorUtil.java +++ b/hutool-core/src/main/java/org/dromara/hutool/core/stream/CollectorUtil.java @@ -484,7 +484,7 @@ public class CollectorUtil { */ public static Collector,List>, Pair,List>> toPairList(Function lMapper, Function rMapper) { - return toPairList(lMapper,rMapper,ArrayList::new,ArrayList::new); + return toPairCollection(lMapper,rMapper,ArrayList::new,ArrayList::new); } @@ -504,7 +504,7 @@ public class CollectorUtil { * @author Tanglt */ public static ,RC extends Collection> - Collector, Pair> toPairList(Function lMapper, + Collector, Pair> toPairCollection(Function lMapper, Function rMapper, Supplier newCollectionL, Supplier newCollectionR) { @@ -544,7 +544,7 @@ public class CollectorUtil { Collector, List, List>, Triple, List, List>> toTripleList(Function lMapper, Function mMapper, Function rMapper) { - return toTripleList(lMapper, mMapper, rMapper, ArrayList::new, ArrayList::new, ArrayList::new); + return toTripleCollection(lMapper, mMapper, rMapper, ArrayList::new, ArrayList::new, ArrayList::new); } /** @@ -570,7 +570,7 @@ public class CollectorUtil { LC extends Collection, MC extends Collection, RC extends Collection> - Collector,Triple> toTripleList(Function lMapper, + Collector,Triple> toTripleCollection(Function lMapper, Function mMapper, Function rMapper, Supplier newCollectionL, diff --git a/hutool-core/src/test/java/org/dromara/hutool/core/stream/CollectorUtilTest.java b/hutool-core/src/test/java/org/dromara/hutool/core/stream/CollectorUtilTest.java index 4451f8c5f..4eab5d0d8 100644 --- a/hutool-core/src/test/java/org/dromara/hutool/core/stream/CollectorUtilTest.java +++ b/hutool-core/src/test/java/org/dromara/hutool/core/stream/CollectorUtilTest.java @@ -148,7 +148,7 @@ public class CollectorUtilTest { Assertions.assertEquals(pairList.getRight().size(),list.size()); Pair, ArrayList> pairMixed = list.stream() - .collect(CollectorUtil.toPairList(Pair::getLeft, Pair::getRight, HashSet::new, ArrayList::new)); + .collect(CollectorUtil.toPairCollection(Pair::getLeft, Pair::getRight, HashSet::new, ArrayList::new)); Assertions.assertEquals(pairMixed.getLeft().size(),list.size()); Assertions.assertEquals(pairMixed.getRight().size(),list.size()); @@ -168,7 +168,7 @@ public class CollectorUtilTest { Assertions.assertEquals(tripleList.getRight().size(),list.size()); Triple, HashSet, ArrayList> tripleMixed = list.stream() - .collect(CollectorUtil.toTripleList(Triple::getLeft, Triple::getMiddle, Triple::getRight, HashSet::new, HashSet::new, ArrayList::new)); + .collect(CollectorUtil.toTripleCollection(Triple::getLeft, Triple::getMiddle, Triple::getRight, HashSet::new, HashSet::new, ArrayList::new)); Assertions.assertEquals(tripleMixed.getLeft().size(),list.size()); Assertions.assertEquals(tripleMixed.getMiddle().size(),list.size());