Last updated

API / geotoolkit / util / iterator / TwoWayArrayIterator

Class: TwoWayArrayIterator<T>

util.iterator.TwoWayArrayIterator

This abstract class defines the interface of a readonly Iterator. Subclasses are responsible for implementing the actual iteration mechanism.

Type parameters

Name
T

Hierarchy

Table of contents

Constructors
Methods

Contents

Constructors

new TwoWayArrayIterator&lt;T&amp;gt;(a)

new TwoWayArrayIterator<T>(a)

Type parameters

Name
T

Parameters

Name Type
aT[]

Overrides

Iterator&lt;T&amp;gt;.constructor

Methods

current

current(): T

Returns

T


filter

filter(f): T[]

Returns the elements of an array that meet the condition specified in a callback function.

Parameters

Name Type Description
f(item: T) => booleanfunction to apply to each element

Returns

T[]

Overrides

Iterator.filter


forEach

forEach(f): TwoWayArrayIterator<T>

Executes a method for each item in iterator and return new iterator.

Parameters

Name Type Description
f(item: T) => voidfunction to apply to each element

Returns

TwoWayArrayIterator<T>

Overrides

Iterator.forEach


getClassName

getClassName(): string

Returns

string

Inherited from

Iterator.getClassName


hasNext

hasNext(): boolean

Returns true if the iteration has more elements.

Returns

boolean

Overrides

Iterator.hasNext


hasPrev

hasPrev(): boolean

Returns

boolean


next(): T

Returns the next element in the iteration.

Returns

T

Overrides

Iterator.next


prev(): T

Returns

T


reset

reset(element?): TwoWayArrayIterator<T>

Resets iterator to its initial state or to the specified element

Throws

if element was not found

Parameters

Name Type Description
Optional elementTelement

Returns

TwoWayArrayIterator<T>

this

Overrides

Iterator.reset


toArray

toArray(maxElements?): T[]

Creates array based on iterator items

Parameters

Name Type Description
Optional maxElementsnumberarray size upper limit

Returns

T[]

Inherited from

Iterator.toArray


awaitForEach

Static awaitForEach<T>(array, func, callback?): void

Runs asynchronous function for each element and wait execution

Type parameters

Name
T

Parameters

Name Type Description
arrayT[] | Iterator<T>array of any object or iterator
func(x: T, next: () => void) => voidfunction to apply to each element
Optional callback() => voidfunction to be called at the end of execution

Returns

void

Inherited from

Iterator.awaitForEach


getArrayIterator

Static getArrayIterator<T>(array, func?): Iterator<T>

Returns iterator by array elements

Type parameters

Name
T

Parameters

Name Type Description
arrayT[]of any object
Optional func(item: T) => booleanto filter elements

Returns

Iterator<T>

Inherited from

Iterator.getArrayIterator


getClassName

Static getClassName(): string

Returns

string

Inherited from

Iterator.getClassName


getIterator

Static getIterator<T>(parameter): Iterator<T>

Returns iterator by the data

Type parameters

Name
T

Parameters

Name Type Description
parameterT | Iterator<T> | T[]data to iterate

Returns

Iterator<T>

Inherited from

Iterator.getIterator


toArray

Static toArray<T>(iterator, maxElements?): T[]

Creates array based on elements to iterate

Type parameters

Name
T

Parameters

Name Type Description
iteratorIterator<T>iterator
Optional maxElementsnumberarray size upper limit

Returns

T[]

Inherited from

Iterator.toArray