修改分流收集器名

This commit is contained in:
tanglitao 2025-02-05 12:45:03 +08:00
parent 5e3bd29804
commit d4dfe741f0
2 changed files with 6 additions and 6 deletions

View File

@ -484,7 +484,7 @@ public class CollectorUtil {
*/
public static <T, L, R> Collector<T, Pair<List<L>,List<R>>, Pair<List<L>,List<R>>> toPairList(Function<T, L> lMapper,
Function<T, R> 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 <T, L, R,LC extends Collection<L>,RC extends Collection<R>>
Collector<T, Pair<LC, RC>, Pair<LC, RC>> toPairList(Function<T, L> lMapper,
Collector<T, Pair<LC, RC>, Pair<LC, RC>> toPairCollection(Function<T, L> lMapper,
Function<T, R> rMapper,
Supplier<LC> newCollectionL,
Supplier<RC> newCollectionR) {
@ -544,7 +544,7 @@ public class CollectorUtil {
Collector<T, Triple<List<L>, List<M>, List<R>>, Triple<List<L>, List<M>, List<R>>> toTripleList(Function<T, L> lMapper,
Function<T, M> mMapper,
Function<T, R> 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<L>,
MC extends Collection<M>,
RC extends Collection<R>>
Collector<T, Triple<LC,MC,RC>,Triple<LC,MC,RC>> toTripleList(Function<T, L> lMapper,
Collector<T, Triple<LC,MC,RC>,Triple<LC,MC,RC>> toTripleCollection(Function<T, L> lMapper,
Function<T, M> mMapper,
Function<T, R> rMapper,
Supplier<LC> newCollectionL,

View File

@ -148,7 +148,7 @@ public class CollectorUtilTest {
Assertions.assertEquals(pairList.getRight().size(),list.size());
Pair<HashSet<Integer>, ArrayList<String>> 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<Integer>, HashSet<Long>, ArrayList<String>> 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());