Interface LongCollector<A,R>
-
- Type Parameters:
A- the intermediary accumulating typeR- the result type
public interface LongCollector<A,R>Primitive collector that operates onlongvalues, resulting in an object of typeR.- Since:
- 1.0.5
- Author:
- Emil Forslund
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description ObjLongConsumer<A>accumulator()Stateless function that takes an accumulating object returned bysupplier()and adds a singlelongvalue to it.Set<Collector.Characteristics>characteristics()Returns a set of characteristics for this collector.BinaryOperator<A>combiner()Stateless function that takes two accumulating objects and returns a single one representing the combined result.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 specifiedsupplier,accumulator,combiner,finisherandcharacteristics.Function<A,R>finisher()Returns a finisher function that takes an accumulating object and turns it into the finaldouble.Supplier<A>supplier()Returns a supplier that can create an intermediary accumulating object.
-
-
-
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 specifiedsupplier,accumulator,combiner,finisherandcharacteristics.- Type Parameters:
A- the type of the intermediary collector objectR- the type of the result- Parameters:
supplier- how new intermediary objects are createdaccumulator- how to add alongto an intermediarycombiner- how to combine two intermediaries into onefinisher- how to turn an intermediary into a resultcharacteristics- 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()
-
accumulator
ObjLongConsumer<A> accumulator()
Stateless function that takes an accumulating object returned bysupplier()and adds a singlelongvalue to it.- Returns:
- the accumulator
- See Also:
Collector.accumulator()
-
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 finaldouble.- Returns:
- the finisher
- See Also:
Collector.finisher()
-
characteristics
Set<Collector.Characteristics> characteristics()
Returns a set of characteristics for this collector.- Returns:
- the characteristics for this collector
- See Also:
Collector.characteristics()
-
-