Skip to content

Reference/Utility Classes/AbstractIterator

A generic iterator very similar to the pattern used in Java.


Class Signature

Description
A generic iterator very similar to the pattern used in Java.

Generic Arguments
- E [any] The type of element which will be returned during iteration over this object.

Initial Version v0.1.0
Latest Version v1.5.0

1
abstract class AbstractIterator<E> implements IIterator<E>

Inheritance

Direct:

  • none

Indirect:

  • none

Direct:

  • IIterator: An interface representing the general form of an iterable class.

Indirect:

  • none

Direct:

Indirect:

  • none

Abstract Instance Method Signatures

#hasNext

Description
Returns true if this iterator has at least one more element that can be returned from next().

Returns [boolean] true if this iterator has at least one more element that can be returned from next().
Implements IIterator#hasNext

1
public abstract hasNext(): boolean

#next

Description
Returns the next element this AbstractIterator has to iterate over.

Returns [E] The next element this AbstractIterator has.
Implements IIterator#next

1
public abstract next(): E

Concrete Instance Method Signatures

#forEachRemaining

Description
Performs the specified action for all of the remaining elements in this AbstractIterator.

Parameters
- callback [(element: E) => void] The action to perform on the remaining elements of this AbstractIterator.

Implements IIterator#forEachRemaining

1
public forEachRemaining(callback: (element: E) => void): void

#remove

Description
Removes and returns the last element returned by the next() method from the underlying data structure.

Returns [E | undefined] The last element returned by the next() method.
Implements IIterator#remove

1
public remove(): E | undefined

#reset

Description
Resets this AbstractIterator back to it's initial position, readying it to iterate over the underlying collection from the 'beginning' again.

Implements IIterator#reset

1
public reset(): void

#[Symbol.iterator]

Implements IIterator#[Symbol.iterator]

1
public [Symbol.iterator](): IterableIterator<E>

#getIterableIterator

Implements IIterator#getIterableIterator

1
public getIterableIterator(): IterableIterator<E>