public static class Combine.IterableCombineFn<V> extends Combine.CombineFn<V,List<V>,V>
SerializableFunction from Iterable<V>s
to Vs into a simple Combine.CombineFn over Vs.
Used in the implementation of convenience methods like
Combine.globally(SerializableFunction),
Combine.perKey(SerializableFunction), and
Combine.groupedValues(SerializableFunction).
| Modifier and Type | Method and Description |
|---|---|
List<V> |
addInput(List<V> accumulator,
V input)
Adds the given input value to the given accumulator, returning the
new accumulator value.
|
List<V> |
createAccumulator()
Returns a new, mutable accumulator value, representing the
accumulation of zero input values.
|
V |
extractOutput(List<V> accumulator)
Returns the output value that is the result of combining all
the input values represented by the given accumulator.
|
List<V> |
mergeAccumulators(Iterable<List<V>> accumulators)
Returns an accumulator representing the accumulation of all the
input values accumulated in the merging accumulators.
|
static <V> Combine.IterableCombineFn<V> |
of(SerializableFunction<Iterable<V>,V> combiner)
Returns a
CombineFn that uses the given
SerializableFunction to combine values. |
static <V> Combine.IterableCombineFn<V> |
of(SerializableFunction<Iterable<V>,V> combiner,
int bufferSize)
Returns a
CombineFn that uses the given
SerializableFunction to combine values,
attempting to buffer at least bufferSize
values between invocations. |
apply, asKeyedFn, getAccumulatorCoder, getDefaultOutputCoder, getOutputTypepublic static <V> Combine.IterableCombineFn<V> of(SerializableFunction<Iterable<V>,V> combiner)
CombineFn that uses the given
SerializableFunction to combine values.public static <V> Combine.IterableCombineFn<V> of(SerializableFunction<Iterable<V>,V> combiner, int bufferSize)
CombineFn that uses the given
SerializableFunction to combine values,
attempting to buffer at least bufferSize
values between invocations.public List<V> createAccumulator()
Combine.CombineFncreateAccumulator in class Combine.CombineFn<V,List<V>,V>public List<V> addInput(List<V> accumulator, V input)
Combine.CombineFnFor efficiency, the input accumulator may be modified and returned.
public List<V> mergeAccumulators(Iterable<List<V>> accumulators)
Combine.CombineFnMay modify any of the argument accumulators. May return a fresh accumulator, or may return one of the (modified) argument accumulators.
mergeAccumulators in class Combine.CombineFn<V,List<V>,V>public V extractOutput(List<V> accumulator)
Combine.CombineFnextractOutput in class Combine.CombineFn<V,List<V>,V>