Class FoldLeft.FoldLeftHelper<T>

java.lang.Object
org.apache.commons.functor.core.algorithm.FoldLeft.FoldLeftHelper<T>
Type Parameters:
T - the returned evaluation type.
All Implemented Interfaces:
Functor, UnaryFunctor<T>, UnaryProcedure<T>
Enclosing class:
FoldLeft<T>

private static class FoldLeft.FoldLeftHelper<T> extends Object implements UnaryProcedure<T>
Helper procedure.
Version:
$Revision$ $Date$
  • Field Details

    • function

      private final BinaryFunction<? super T, ? super T, ? extends T> function
      The wrapped function.
    • seed

      private T seed
      The seed object.
    • started

      private boolean started
      Flag to check the helper started or not.
  • Constructor Details

    • FoldLeftHelper

      public FoldLeftHelper(BinaryFunction<? super T, ? super T, ? extends T> function)
      Create a seedless FoldLeftHelper.
      Parameters:
      function - The wrapped function
    • FoldLeftHelper

      FoldLeftHelper(T seed, BinaryFunction<? super T, ? super T, ? extends T> function)
      Create a new FoldLeftHelper.
      Parameters:
      seed - initial left-side argument
      function - The wrapped function
  • Method Details

    • run

      public void run(T obj)
      Execute this procedure.
      Specified by:
      run in interface UnaryProcedure<T>
      Parameters:
      obj - an A parameter to this execution
    • getResult

      T getResult()
      Get current result.
      Returns:
      Object