Class SelectionImpl<T>

java.lang.Object
com.terracottatech.store.function.SelectionImpl<T>
All Implemented Interfaces:
Selection<T>, Iterable<T>, Collection<T>
Direct Known Subclasses:
TypedValueSelectionImpl

public class SelectionImpl<T> extends Object implements Selection<T>
  • Constructor Details

    • SelectionImpl

      public SelectionImpl()
    • SelectionImpl

      public SelectionImpl(Collection<T> list)
  • Method Details

    • get

      public Optional<T> get(int index)
      Description copied from interface: Selection
      Fetch a value at a specific index in the Selection. If the resolved index is outside the bounds of 0...size(), Optional.empty() will be returned. It supports negative indexes to allow for easy retrieval of tail values.
      Specified by:
      get in interface Selection<T>
      Parameters:
      index - 0..size()-1, returns the value at the index. If < 0, returns the value at size()-index (so -1 returns the last, -2 returns 1 from the last, etc).
      Returns:
      Optional of value.
    • size

      public int size()
      Specified by:
      size in interface Collection<T>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<T>
    • contains

      public boolean contains(Object o)
      Specified by:
      contains in interface Collection<T>
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Collection<T>
      Specified by:
      iterator in interface Iterable<T>
    • toArray

      public Object[] toArray()
      Specified by:
      toArray in interface Collection<T>
    • toArray

      public <T1> T1[] toArray(T1[] a)
      Specified by:
      toArray in interface Collection<T>
    • containsAll

      public boolean containsAll(Collection<?> c)
      Specified by:
      containsAll in interface Collection<T>
    • addAll

      public boolean addAll(Collection<? extends T> c)
      Specified by:
      addAll in interface Collection<T>
    • toString

      public String toString()
      Overrides:
      toString in class Object