Interface Index<T>

All Superinterfaces:
Iterable<T>, Serializable
All Known Implementing Classes:
ArrayIndex, DynamicEnum, DynamicEnum.Coproduct, DynamicEnum.Product, EnumIndex, HashIndex, SetIndex

public interface Index<T> extends Iterable<T>, Serializable
An index is a totally ordered finite collection, the generalization of an enum type. An index maintains a one-to-one relationship between its elements and the integers 0 to n-1.
  • Method Details

    • size

      int size()
      Returns the number of objects in this index. This number is nonnegative.
      Returns:
      the number of objects in this index.
    • isEmpty

      default boolean isEmpty()
    • get

      T get(int i)
      Returns the object associated with a given number.
      Returns:
      the object associated with a given number.
      Throws:
      IndexOutOfBoundsException - if i < 0 or i >= size().
    • contains

      boolean contains(T t)
    • indexOf

      int indexOf(T t)
    • containsUnchecked

      boolean containsUnchecked(Object t)
    • indexOfUnchecked

      int indexOfUnchecked(Object t)
    • comparator

      default Comparator<T> comparator()
    • enumerate

      default List<T> enumerate()