All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.metamx.common.guava.YieldingSequenceBase Maven / Gradle / Ivy

There is a newer version: 0.25.5
Show newest version
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