shadow:standard

Interface Iterator<T>

interface Iterator<T>

Interface Iterator<T> allows each item in a collection to be visited. It is expected that most container classes will have an inner class with this interface. This interface differs from IteratorNullable<T> in that the values it retrieves are guaranteed never to be null.

See Also

Method Summary

Modifiers Return Types Method and Description
public readonly (boolean) hasNext()

Method to check if there is another value that the iterator has not yet visited in the collection.

public (T) next()

Method to move the iterator forward and retrieve the next value in the collection.

Method Detail

hasNext

public readonly hasNext() => (boolean)

Method to check if there is another value that the iterator has not yet visited in the collection.

Returns

true if there is another value to visit

next

public next() => (T)

Method to move the iterator forward and retrieve the next value in the collection. Implementations are expected to throw a NoSuchElementException if there are no more values.

Returns

next value

See Also