Package ste.lloop
Class IndexedSequence<T>
- Type Parameters:
T- the type of the elements in the array
- Direct Known Subclasses:
ArraySequence,ListSequence
A loop over an array that can be configured with a starting and ending index.
This class is not meant to be instantiated directly. Use Loop.on(Object[]) to start
building an array loop.
The loop can be configured with a from index, a to index, and a step value.
If from and to are equal, the loop will not execute.
The loop can be executed by calling one of the two loop methods: one that provides both the index and the element, and one that provides only the element.
-
Field Summary
Fields inherited from class ste.lloop.AbstractSequence
indexes -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class ste.lloop.AbstractSequence
from, step, to
-
Constructor Details
-
IndexedSequence
protected IndexedSequence()Constructs a newIndexedSequenceinstance.
-
-
Method Details
-
loop
Executes the given consumer for each element in the loop.If the array provided to the constructor was
null, this method will do nothing.- Type Parameters:
R- the type of the return value- Parameters:
consumer- the consumer to execute for each element- Returns:
- the value passed to
Loop.brk(Object), ornullif the loop completes without abrk
-
loop
Executes the given consumer for each element in the loop.If the array provided to the constructor was
null, this method will do nothing.- Type Parameters:
R- the type of the return value- Parameters:
consumer- the consumer to execute for each element- Returns:
- the value passed to
Loop.brk(Object), ornullif the loop completes without abrk
-