listIterator

open override fun listIterator(): ObjectListIterator<E>

Delegates to listIterator(0).


open override fun listIterator(index: Int): ObjectListIterator<E>

Return a fail-safe iterator over the list elements (a custom ObjectListIterator).

The iterator supports add, remove, set operations but will enforce the same weight bounds & ordering invariants as direct list operations.

The returned iterator's behavior:

  • remove() and set(e) are allowed only when the iterator's last returned index (lastRet) is valid; otherwise they throw IllegalStateException.

  • add(e) inserts at the iterator's current cursor position; the inserted element's weight must fit between the left and right neighbors or an IllegalStateException is thrown.

Parameters

index

starting index for the iterator (use listIterator() for index 0)

Throws

if index is invalid