next() or prev().
An internal index is used to keep track of the current element. This index can be also be set manually by
calling setIndex(int).
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private final @NotNull T[] |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public T | Returns: The element at the given relative index.The relative index. relativeIndex)Returns the element at the given relative index. |
| public static < The type of the elements. T> LoopPool | Returns: A newLoopPool with the given elements.The elements to loop through. pool)Creates a new |
| public T | |
| public int | |
| private int | Returns: A valid index to use in the pool array.The index to validate. index)Returns a valid index to use in the pool array. |
| public T | Returns: The next element in the sequence.Returns the next element in the sequence and increments the internal index. |
| public static < The type of the elements. T> LoopPool | |
| public static < The type of the elements. T> LoopPool | |
| public T | Returns: The previous element in the sequence.Returns the previous element in the sequence and decrements the internal index. |
| public void |
| index | back to summary |
|---|---|
| private int index | |
| pool | back to summary |
|---|---|
| private final @NotNull T[] pool | |
| LoopPool | back to summary |
|---|---|
private LoopPool(int startAt, @NotNull T... pool)
| |
| at | back to summary |
|---|---|
| public T at(int relativeIndex) Returns the element at the given relative index. The index is relative to the internal index.
| |
| atRandomIndex | back to summary |
|---|---|
| public static <T> LoopPool Creates a new | |
| current | back to summary |
|---|---|
| public T current() Returns the current element in the sequence.
| |
| getIndex | back to summary |
|---|---|
| public int getIndex() Returns the internal index.
| |
| getValidIndex | back to summary |
|---|---|
| private int getValidIndex(int index) Returns a valid index to use in the pool array. If the index goes out of bounds, it will always wrap around.
| |
| next | back to summary |
|---|---|
| public T next() Returns the next element in the sequence and increments the internal index.
| |
| of | back to summary |
|---|---|
| public static <T> LoopPool Creates a new | |
| of | back to summary |
|---|---|
| public static <T> LoopPool Creates a new | |
| prev | back to summary |
|---|---|
| public T prev() Returns the previous element in the sequence and decrements the internal index.
| |
| setIndex | back to summary |
|---|---|
| public void setIndex(int index) Sets the internal index to the given index. If the index goes out of bounds, it will always wrap around.
| |