package bjc.utils.funcutils; import java.util.stream.Collector; import bjc.data.IHolder; import bjc.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); } }