Library / Collections / Lists / OwnedListIterator
OwnedListIterator
Forward cursor over OwnedList[T].
Constructors 1
INIT(REFERENCE OwnedListNode[T] sourceHeadNode)
Methods 4
METHOD hasNext() RETURNS booleanreads
Iterator — TRUE while the cursor still sits on a user node. The ender
sentinel is id 1, which is exactly the condition next() refuses on,
so the two agree by construction.
This class implemented NO interface at all until now, which is why it
alone of the iterators could not satisfy Collection.iterator() —
ArrayIterator and the rest were already BidirectionalIterator OF T.
METHOD peek() RETURNS | REFERENCE Treads
ReferenceIterator — the reference at the current cursor WITHOUT
advancing. Same pipe-XOR shape as next() and the same refusal at the
ender sentinel; it simply does not move cursorRef.
MODIFY METHOD skip(uint64 n) RETURNS | REFERENCE Tmodifies
ReferenceIterator — advance n positions and yield what lands under
the cursor. skip(0) is next(); running off the ender fails exactly
as next() does, so a short list refuses rather than walking past the
sentinel.
MODIFY METHOD next() RETURNS | REFERENCE Tmodifies
Advance and yield the next element by REFERENCE. Pipe-XOR:
SUCCESS populates value; FAILURE once the cursor reaches the
ender sentinel (end of iteration).