Interface LongCollector<A,​R>

  • Type Parameters:
    A - the intermediary accumulating type
    R - the result type

    public interface LongCollector<A,​R>
    Primitive collector that operates on long values, resulting in an object of type R.
    Since:
    1.0.5
    Author:
    Emil Forslund
    • Method Detail

      • create

        static <A,​R> LongCollector<A,​R> create​(Supplier<A> supplier,
                                                           ObjLongConsumer<A> accumulator,
                                                           BinaryOperator<A> combiner,
                                                           Function<A,​R> finisher,
                                                           Set<Collector.Characteristics> characteristics)
        Creates and returns a new instance of this interface that simply holds the specified supplier, accumulator, combiner, finisher and characteristics.
        Type Parameters:
        A - the type of the intermediary collector object
        R - the type of the result
        Parameters:
        supplier - how new intermediary objects are created
        accumulator - how to add a long to an intermediary
        combiner - how to combine two intermediaries into one
        finisher - how to turn an intermediary into a result
        characteristics - defining characteristics of this collector
        Returns:
        the new collector
      • supplier

        Supplier<A> supplier()
        Returns a supplier that can create an intermediary accumulating object.
        Returns:
        the supplier for the accumulating object
        See Also:
        Collector.supplier()
      • combiner

        BinaryOperator<A> combiner()
        Stateless function that takes two accumulating objects and returns a single one representing the combined result. This can be either one of the two instances or a completely new instance.
        Returns:
        the combiner
        See Also:
        Collector.combiner()
      • finisher

        Function<A,​R> finisher()
        Returns a finisher function that takes an accumulating object and turns it into the final double.
        Returns:
        the finisher
        See Also:
        Collector.finisher()