Returns whether next() has an element to return. Never throws. Time: O(1) unless the
collection documents otherwise.
Returns whether previous() has an element to return. Never throws. Time: O(1).
Inserts element just before the cursor: a following next() is unaffected and a following
previous() returns element.
Time: as the list's insert at this position.
The element to insert.
Returns the next element.
Time: O(1) unless the collection documents otherwise.
The next element.
Returns the index of the element next() would return, or size at the end. Never throws.
Time: O(1).
Returns the element before the cursor and moves the cursor back past it.
Time: O(1).
The previous element.
Returns the index of the element previous() would return, or -1 at the start. Never
throws. Time: O(1).
Replaces the element the last next() or previous() returned. Open iterators and other
cursors stay valid.
Time: O(1).
The new element.
A cursor over a list that moves both ways and edits at its position. It sits between two elements:
next()returns the element after it,previous()the element before it.Example