TextElementIterator

Iterator that tracks its current position in a TextElement list.

Unlike standard ListIterator, this class provides direct access to the current index via currentIndex, which returns the index of the element that was returned by the most recent call to next or previous.

This iterator is a replacement for the internal ArrayIterator class, with clearer semantics and better naming. It correctly handles bidirectional iteration by maintaining the current index internally.

Since

3.28.0

Constructors

Link copied to clipboard
constructor(elements: List<TextElement>, fromIndex: Int)
Creates an iterator starting at the specified index.

Functions

Link copied to clipboard
open fun add(element: TextElement)
Link copied to clipboard
open fun currentIndex(): Int
Returns the index of the element that was returned by the most recent call to next or previous.
Link copied to clipboard
open fun forEachRemaining(action: Consumer<in E>)
Link copied to clipboard
open fun hasNext(): Boolean
Link copied to clipboard
open fun hasPrevious(): Boolean
Link copied to clipboard
open fun next(): TextElement
Link copied to clipboard
open fun nextIndex(): Int
Link copied to clipboard
open fun previous(): TextElement
Link copied to clipboard
open fun previousIndex(): Int
Link copied to clipboard
open fun remove()
Link copied to clipboard
open fun set(element: TextElement)