Class FoldLeft.FoldLeftHelper<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private BinaryFunction<? super T,​? super T,​? extends T> function
      The wrapped function.
      private T seed
      The seed object.
      private boolean started
      Flag to check the helper started or not.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) T getResult()
      Get current result.
      void run​(T obj)
      Execute this procedure.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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 Detail

      • 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 Detail

      • 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