
com.metamx.common.guava.YieldingSequenceBase Maven / Gradle / Ivy
package com.metamx.common.guava;
import com.google.common.io.Closeables;
/**
* A Sequence that is based entirely on the Yielder implementation.
*
* This is a base class to simplify the creation of Sequences.
*/
public abstract class YieldingSequenceBase implements Sequence
{
@Override
public OutType accumulate(OutType initValue, Accumulator accumulator)
{
Yielder yielder = toYielder(initValue, YieldingAccumulators.fromAccumulator(accumulator));
try {
return yielder.get();
}
finally {
Closeables.closeQuietly(yielder);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy