interface IteratorNullable<T>
Interface IteratorNullable<T>
allows each item in a collection to be visited. It is expected that container classes that can contain null
value will have an inner class with this interface. This interface differs from Iterator<T>
in that the values it retrieves may sometimes be null
.
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 |
(nullable T) |
next() Method to move the iterator forward and retrieve the next value in the collection, which might be |
public readonly hasNext() => (boolean)
Method to check if there is another value that the iterator has not yet visited in the collection.
true
if there is another value to visit
public next() => (nullable T)
Method to move the iterator forward and retrieve the next value in the collection, which might be null
. Implementations are expected to throw a NoSuchElementException
if there are no more values.
next value