TextElementList

Default mutable implementation of TextElementSequence.

This class wraps an existing List<TextElement> without copying it. All mutations directly affect the underlying list.

The implementation provides optimized search operations and clear semantics for index-based manipulations required by lexical preservation operations.

Since

3.28.0

Constructors

Link copied to clipboard
constructor(elements: List<TextElement>)
Creates a wrapper around the given list.

Functions

Link copied to clipboard
open fun allMatch(predicate: Predicate<TextElement>): Boolean
Tests whether all elements in this sequence match the given predicate.
Link copied to clipboard
open fun anyMatch(predicate: Predicate<TextElement>): Boolean
Tests whether any element in this sequence matches the given predicate.
Link copied to clipboard
open fun copyOf(elements: List<TextElement>): TextElementList
Creates a new TextElementList with a copy of the given list.
Link copied to clipboard
Creates an empty mutable TextElementList.
Link copied to clipboard
open fun equals(obj: Any): Boolean
Link copied to clipboard
open fun findFirst(predicate: Predicate<TextElement>): Int
Finds the first index where the predicate matches, searching forward from index 0.
Link copied to clipboard
open fun findLast(predicate: Predicate<TextElement>): Int
Finds the last index where the predicate matches, searching backward from the end.
Link copied to clipboard
open fun findNext(fromIndex: Int, predicate: Predicate<TextElement>): Int
Finds the next index where the predicate matches, searching forward from fromIndex (inclusive).
Link copied to clipboard
open fun findPrevious(fromIndex: Int, predicate: Predicate<TextElement>): Int
Finds the previous index where the predicate matches, searching backward from fromIndex (inclusive).
Link copied to clipboard
open fun get(index: Int): TextElement
Returns the element at the specified index.
Link copied to clipboard
open fun hashCode(): Int
Link copied to clipboard
open fun indexOf(element: TextElement): Int
Finds the first occurrence of the specified element.
open fun indexOf(fromIndex: Int, element: TextElement): Int
Finds the next occurrence of element starting from fromIndex (inclusive).
Link copied to clipboard
open fun insert(index: Int, element: TextElement)
Inserts element at the specified index.
Link copied to clipboard
open fun insertAll(index: Int, elementsToInsert: List<TextElement>)
Inserts all elements at the specified index.
Link copied to clipboard
open fun isEmpty(): Boolean
Checks if this sequence is empty.
Link copied to clipboard
open fun isValidIndex(index: Int): Boolean
Checks if the index is valid (0 <= index
Link copied to clipboard
open fun iterator(fromIndex: Int): TextElementIterator
Returns an iterator starting at the specified index.
Returns an iterator starting at index 0.
Link copied to clipboard
open fun lastIndexOf(element: TextElement): Int
Finds the last occurrence of the specified element.
open fun lastIndexOf(fromIndex: Int, element: TextElement): Int
Finds the previous occurrence of element before fromIndex (inclusive).
Link copied to clipboard
open fun noneMatch(predicate: Predicate<TextElement>): Boolean
Tests whether no elements in this sequence match the given predicate.
Link copied to clipboard
open fun of(elements: Array<TextElement>): TextElementList
Creates a new TextElementList containing the given elements.
open fun of(elements: List<TextElement>): TextElementList
Creates a new TextElementList wrapping the given list.
Link copied to clipboard
open fun remove(index: Int)
Removes the element at the specified index.
Link copied to clipboard
open fun removeRange(fromIndex: Int, toIndex: Int)
Removes elements in range [fromIndex, toIndex] (inclusive on both ends).
Link copied to clipboard
open fun size(): Int
Returns the number of elements in this sequence.
Link copied to clipboard
Returns a stream of elements for functional operations.
Link copied to clipboard
open fun subList(fromIndex: Int, toIndex: Int): List<TextElement>
Returns a sublist view [fromIndex, toIndex).
Link copied to clipboard
Returns a new list containing elements from the start until the predicate fails.
Link copied to clipboard
open fun toList(): List<TextElement>
Returns an unmodifiable view of the underlying list.
Link copied to clipboard
Returns the underlying mutable list.
Link copied to clipboard
open fun toString(): String