Iterables<E> extension

Provides functions for transforming Iterables to other collections.

Functions that rely on the ordering of elements are non-deterministic if an iterable is unordered, i.e. HashSet.

on

Properties

indexed Iterable<(int, E)>

Available on Iterable<E>, provided by the Iterables extension

Returns a lazy iterable with records that contain an iteration index and element.
no setter

Methods

associate<R>({required Select<E, R> by}) Map<R, E>

Available on Iterable<E>, provided by the Iterables extension

Returns a map that associates values returned by by with elements in this iterable.
distinct({required Select<E, Object?> by}) Iterable<E>

Available on Iterable<E>, provided by the Iterables extension

Returns a lazy iterable with only distinct elements.
toMap<K, V>((K, V) create(E element)) Map<K, V>

Available on Iterable<E>, provided by the Iterables extension

Returns a modifiable map using create to produce entries from elements in this iterable.
toUnmodifiableList() List<E>

Available on Iterable<E>, provided by the Iterables extension

Transforms this iterable into an unmodifiable List.
toUnmodifiableMap<K, V>((K, V) create(E element)) Map<K, V>

Available on Iterable<E>, provided by the Iterables extension

Returns an unmodifiable map using create to produce entries from elements in this iterable.
toUnmodifiableSet() Set<E>

Available on Iterable<E>, provided by the Iterables extension

Transforms this iterable into an unmodifiable Set.