Class TextElementIterator

java.lang.Object
com.github.javaparser.printer.lexicalpreservation.TextElementIterator
All Implemented Interfaces:
Iterator<TextElement>, ListIterator<TextElement>

public class TextElementIterator extends Object implements ListIterator<TextElement>
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