public static class Combine.SimpleCombineFn<V> extends Combine.CombineFn<V,java.util.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 |
|---|---|
java.util.List<V> |
addInput(java.util.List<V> accumulator,
V input)
Adds the given input value to the given accumulator, returning the
new accumulator value.
|
java.util.List<V> |
createAccumulator()
Returns a new, mutable accumulator value, representing the
accumulation of zero input values.
|
V |
extractOutput(java.util.List<V> accumulator)
Returns the output value that is the result of combining all
the input values represented by the given accumulator.
|
java.util.List<V> |
mergeAccumulators(java.lang.Iterable<java.util.List<V>> accumulators)
Returns an accumulator representing the accumulation of all the
input values accumulated in the merging accumulators.
|
static <V> Combine.SimpleCombineFn<V> |
of(SerializableFunction<java.lang.Iterable<V>,V> combiner)
Returns a
CombineFn that uses the given
SerializableFunction to combine values. |
apply, asKeyedFn, getAccumulatorCoder, getDefaultOutputCoderpublic static <V> Combine.SimpleCombineFn<V> of(SerializableFunction<java.lang.Iterable<V>,V> combiner)
CombineFn that uses the given
SerializableFunction to combine values.public java.util.List<V> createAccumulator()
Combine.CombineFncreateAccumulator in class Combine.CombineFn<V,java.util.List<V>,V>public java.util.List<V> addInput(java.util.List<V> accumulator, V input)
Combine.CombineFnFor efficiency, the input accumulator may be modified and returned.
addInput in class Combine.CombineFn<V,java.util.List<V>,V>public java.util.List<V> mergeAccumulators(java.lang.Iterable<java.util.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,java.util.List<V>,V>public V extractOutput(java.util.List<V> accumulator)
Combine.CombineFnextractOutput in class Combine.CombineFn<V,java.util.List<V>,V>