Package uk.ac.starlink.util
Interface SplitCollector<S extends Splittable<S>,A>
- Type Parameters:
A
- accumulator typeS
- splittable content type
public interface SplitCollector<S extends Splittable<S>,A>
Defines an object that can collect values from a Splittable into
an accumulator.
The order of the split items is not considered significant,
so splittables may be presented to accumulator instances in any order.
- Since:
- 12 Sep 2019
- Author:
- Mark Taylor
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accumulate
(S splittable, A accumulator) Consumes the content of a splittable, collecting results into the supplied accumulator.Combines the content of two accumulators.Returns a new accumulator into which results can be collected.
-
Method Details
-
createAccumulator
A createAccumulator()Returns a new accumulator into which results can be collected. Accumulator instances may only be used from one thread at any one time.- Returns:
- new accumulator
-
accumulate
Consumes the content of a splittable, collecting results into the supplied accumulator. This method may not be called concurrently on the same splittable.- Parameters:
splittable
- splittable objectaccumulator
- accumulator
-
combine
Combines the content of two accumulators. The returned value may or may not be the same object as one of the input values. The input values should not be used following this call. The sequence of the input values is not significant.- Parameters:
acc1
- one input accumulatoracc2
- other input accumulator- Returns:
- accumulator containing the combined result of the inputs
-