dartora

ImmutableIterationHolder

ImmutableIterationHolder is a concrete subclass of the Iteration<E> mixin that exposes a read‑only concatenation of multiple Iteration<E> sequences. It differs from IterationHolder in that it does not allow mutation of the underlying segments; it simply presents the items one after another as a single iterable view.

Constructor

ImmutableIterationHolder({
  required Iterable<Iteration<E>> items,
  int startIndex = 0,
  int indexTake = 0,
})

On construction the class pre‑computes sourceLength by folding the lengths of all items. If you modify the lengths of those items after construction, the ImmutableIterationHolder will not update its cached length; it is intended to be used with immutable children.

Fields

Field Description
items The ordered collection of child Iteration<E> objects being concatenated.
startIndex Inherited from Iteration; number of elements at the beginning of the concatenation that are not visible.
indexTake Inherited from Iteration; number of elements at the end of the concatenation that are hidden.
sourceLength Total number of elements across all child iterations (computed once at construction).

Implementation details

Usage

Use ImmutableIterationHolder when you need to present several Iteration sequences as a single read‑only iterable. Because it caches sourceLength and does not expose any mutating methods, it is lightweight and suitable for building composite views.