API / geotoolkit / util / iterator / TwoWayArrayIterator
util.iterator.TwoWayArrayIterator
This abstract class defines the interface of a readonly Iterator. Subclasses are responsible for implementing the actual iteration mechanism.
| Name |
|---|
T |
Iterator<T>↳
TwoWayArrayIterator
Constructors
Methods
Constructors
• new TwoWayArrayIterator<T>(a)
| Name |
|---|
T |
| Name | Type |
|---|---|
a | T[] |
Iterator<T&gt;.constructor
Methods
▸ current(): T
T
▸ filter(f): T[]
Returns the elements of an array that meet the condition specified in a callback function.
| Name | Type | Description |
|---|---|---|
f | (item: T) => boolean | function to apply to each element |
T[]
▸ forEach(f): TwoWayArrayIterator<T>
Executes a method for each item in iterator and return new iterator.
| Name | Type | Description |
|---|---|---|
f | (item: T) => void | function to apply to each element |
▸ getClassName(): string
string
▸ hasNext(): boolean
Returns true if the iteration has more elements.
boolean
▸ hasPrev(): boolean
boolean
▸ next(): T
Returns the next element in the iteration.
T
▸ prev(): T
T
▸ reset(element?): TwoWayArrayIterator<T>
Resets iterator to its initial state or to the specified element
Throws
if element was not found
| Name | Type | Description |
|---|---|---|
Optional element | T | element |
this
▸ 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[]