API / geotoolkit / util / iterator / Iterator
This abstract class defines the interface of a readonly Iterator. Subclasses are responsible for implementing the actual iteration mechanism.
| Name |
|---|
T |
Iterator
Constructors
Methods
Methods
▸ Abstract filter(func): T[]
Returns the elements of an array that meet the condition specified in a callback function.
| Name | Type | Description |
|---|---|---|
func | (item: T) => boolean | function to apply to each element |
T[]
▸ Abstract filter<S>(predicate): S[]
Returns the elements of an array that meet the condition specified in a callback function.
| Name |
|---|
S |
| Name | Type | Description |
|---|---|---|
predicate | (value: T) => value is S | filter function |
S[]
▸ Abstract filter(func): T[]
| Name | Type |
|---|---|
func | (item: T) => boolean |
T[]
▸ Abstract forEach(func): Iterator<T>
Executes a method for each item in iterator and return new iterator.
| Name | Type | Description |
|---|---|---|
func | (item: T) => void | function to apply to each element |
Iterator<T>
▸ getClassName(): string
string
▸ Abstract hasNext(): boolean
Returns true if the iteration has more elements.
boolean
▸ Abstract next(): T
Returns the next element in the iteration.
T
▸ Abstract reset(): Iterator<T>
Resets iterator to its initial state.
Iterator<T>
▸ toArray(maxElements?): T[]
Creates array based on iterator items
| Name | Type | Description |
|---|---|---|
Optional maxElements | number | array size upper limit |
T[]
▸ Static awaitForEach<T>(array, func, callback?): void
Runs asynchronous function for each element and wait execution
| Name |
|---|
T |
| Name | Type | Description |
|---|---|---|
array | T[] | Iterator<T> | array of any object or iterator |
func | (x: T, next: () => void) => void | function to apply to each element |
Optional callback | () => void | function to be called at the end of execution |
void
▸ Static getArrayIterator<T>(array, func?): Iterator<T>
Returns iterator by array elements
| Name |
|---|
T |
| Name | Type | Description |
|---|---|---|
array | T[] | of any object |
Optional func | (item: T) => boolean | to filter elements |
Iterator<T>
▸ Static getClassName(): string
string
▸ Static getIterator<T>(parameter): Iterator<T>
Returns iterator by the data
| Name |
|---|
T |
| Name | Type | Description |
|---|---|---|
parameter | T | Iterator<T> | T[] | data to iterate |
Iterator<T>
▸ Static toArray<T>(iterator, maxElements?): T[]
Creates array based on elements to iterate
| Name |
|---|
T |
| Name | Type | Description |
|---|---|---|
iterator | Iterator<T> | iterator |
Optional maxElements | number | array size upper limit |
T[]