Iterator
interface Iterator<T>
next and hasNext are all an implementation has to provide. The rest — previous, hasPrevious, index, moveTo, size, toStart, toEnd — is optional, so a forward-only source can satisfy the interface without pretending to do more than it can.
It is the shape a paged reader takes: rows arriving from a service in batches look like one sequence to the code that consumes them.
Examples
Shape
while (iterator.hasNext()) {
const value = iterator.next();
}
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.