Package eu.bandm.tools.ops
Interface Index<T>
- All Superinterfaces:
Iterable<T>
,Serializable
- All Known Implementing Classes:
ArrayIndex
,DynamicEnum
,DynamicEnum.Coproduct
,DynamicEnum.Product
,EnumIndex
,HashIndex
,SetIndex
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 Summary
Modifier and TypeMethodDescriptiondefault Comparator<T>
boolean
boolean
get
(int i) Returns the object associated with a given number.int
int
default boolean
isEmpty()
int
size()
Returns the number of objects in this index.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
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
Returns the object associated with a given number.- Returns:
- the object associated with a given number.
- Throws:
IndexOutOfBoundsException
- ifi < 0
ori >= size()
.
-
contains
-
indexOf
-
containsUnchecked
-
indexOfUnchecked
-
comparator
-
enumerate
-