of

open fun of(elements: Array<TextElement>): TextElementList(source)

Creates a new TextElementList containing the given elements.

Return

a new list

Parameters

elements

varargs of elements


open fun of(elements: List<TextElement>): TextElementList(source)

Creates a new TextElementList wrapping the given list.

IMPORTANT: This method wraps the list directly without copying. Modifications to the TextElementList will affect the original list. Use copyOf if you need an independent copy.

This method is useful for chaining operations:


List<TextElement> result = TextElementList.of(list.subList(0, 10))
    .takeWhile(TextElement::isSpaceOrTab);

Return

a new TextElementList wrapping the given list

Parameters

elements

the list to wrap (not copied)

Throws