From c82e3b3b2de0633317ec8fc85925e91422820597 Mon Sep 17 00:00:00 2001 From: "Benjamin J. Culkin" Date: Sun, 8 Oct 2017 22:39:59 -0300 Subject: Start splitting into maven modules --- .../java/bjc/utils/funcutils/CollectorUtils.java | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 base/src/main/java/bjc/utils/funcutils/CollectorUtils.java (limited to 'base/src/main/java/bjc/utils/funcutils/CollectorUtils.java') diff --git a/base/src/main/java/bjc/utils/funcutils/CollectorUtils.java b/base/src/main/java/bjc/utils/funcutils/CollectorUtils.java new file mode 100644 index 0000000..a044bfd --- /dev/null +++ b/base/src/main/java/bjc/utils/funcutils/CollectorUtils.java @@ -0,0 +1,39 @@ +package bjc.utils.funcutils; + +import java.util.stream.Collector; + +import bjc.utils.data.IHolder; +import bjc.utils.data.IPair; + +/** + * Utilities for producing implementations of {@link Collector} + * + * @author ben + * + */ +public class CollectorUtils { + /** + * Create a collector that applies two collectors at once + * + * @param + * The type of the collection to collect from + * @param + * The intermediate type of the first collector + * @param + * The intermediate type of the second collector + * @param + * The final type of the first collector + * @param + * The final type of the second collector + * @param first + * The first collector to use + * @param second + * The second collector to use + * @return A collector that functions as mentioned above + */ + public static Collector>, IPair> compoundCollect( + final Collector first, + final Collector second) { + return new CompoundCollector<>(first, second); + } +} -- cgit v1.2.3