Class RowIndexToValueSupplier<T>

java.lang.Object
guru.mikelue.foxglove.functional.RowIndexToValueSupplier<T>
Type Parameters:
T - Type of value to be provided
All Implemented Interfaces:
StatefulSupplier<T>, Supplier<T>

public class RowIndexToValueSupplier<T> extends Object implements StatefulSupplier<T>
This is a stateful Supplier, which need client code to implements Function.apply(T) method. The value of row index is maintained internally which is fed to Function.apply(T).
  • Method Details

    • of

      public static <T> RowIndexToValueSupplier<T> of(RowIndexToValue<T> toValueFunc)
      Creates the supplier with given function to get value at specified row index.
      Type Parameters:
      T - The type of value supplied
      Parameters:
      toValueFunc - The function to get value at specified row index
      Returns:
      The created supplier
    • get

      public T get()
      Gets the value at current row index, then advances the row index by one.
      Specified by:
      get in interface Supplier<T>
      Returns:
      The value at current row index
    • getCurrentIndex

      public int getCurrentIndex()
      Gets the the row index to be used for next time calling of get() .
      Returns:
      The value at specified row index