Class ItemAt<T>

  • Type Parameters:
    T - Scalar type
    All Implemented Interfaces:
    Scalar<T>

    public final class ItemAt<T>
    extends Object
    implements Scalar<T>
    Element from position in Iterable or fallback value if iterable doesn't have this position.

    There is no thread-safety guarantee.

    Since:
    0.7
    • Constructor Detail

      • ItemAt

        public ItemAt​(int position,
                      Iterable<? extends T> iterable)
        Ctor.
        Parameters:
        position - Position
        iterable - Iterable
      • ItemAt

        public ItemAt​(int position,
                      T fallback,
                      Iterable<? extends T> iterable)
        Ctor.
        Parameters:
        position - Position
        fallback - Fallback value
        iterable - Iterable
      • ItemAt

        public ItemAt​(int position,
                      Func<? super Iterable<? extends T>,​? extends T> fallback,
                      Iterable<? extends T> iterable)
        Ctor.
        Parameters:
        position - Position
        fallback - Fallback value
        iterable - Iterable
    • Method Detail

      • value

        public T value()
                throws Exception
        Description copied from interface: Scalar
        Convert it to the value.
        Specified by:
        value in interface Scalar<T>
        Returns:
        The value
        Throws:
        Exception - If fails