Class Subindexed<T>

java.lang.Object
org.javimmutable.collections.common.Subindexed<T>
All Implemented Interfaces:
Indexed<T>

@Immutable public class Subindexed<T> extends Object implements Indexed<T>
Wrapper for an Indexed that only provides access to a portion of the full Indexed's values.
  • Constructor Details

    • Subindexed

      public Subindexed(@Nonnull Indexed<? extends T> source, int offset, int limit)
  • Method Details

    • of

      public static <T> Subindexed<T> of(@Nonnull Indexed<? extends T> source, int offset)
    • of

      public static <T> Subindexed<T> of(@Nonnull Indexed<? extends T> source, int offset, int limit)
    • get

      public T get(int index)
      Description copied from interface: Indexed
      Retrieve the value. The index must be valid for the container's current size (i.e. [0-size)
      Specified by:
      get in interface Indexed<T>
    • find

      @Nonnull public Maybe<T> find(int index)
      Description copied from interface: Indexed
      Retrieves a Holder containing the (possibly null) value at the specified index if it exists. If no such value exists returns an empty Holder.
      Specified by:
      find in interface Indexed<T>
    • size

      public int size()
      Description copied from interface: Indexed
      Retrieve the number of values available in the container.
      Specified by:
      size in interface Indexed<T>