collectInto

inline fun <ID : Any, T, R, C : MutableCollection<R>> Field<ID, T>.collectInto(reductionType: ReductionType = ExcludingSelf, crossinline produceAccumulator: (Int) -> C, crossinline predicate: Predicate<FieldEntry<ID, T>>, crossinline transform: (FieldEntry<ID, T>) -> R): C

Collects the field entries that satisfy the given predicate, transforms them using transform, and stores the results in a new Collection produced by produceAccumulator.

By default, the local entry is excluded from the result. It is included only if reductionType is it.unibo.collektive.stdlib.util.IncludingSelf.

Return

a mutable collection containing the transformed matching entries.

Parameters

reductionType

specifies whether to include the local entry (default is ExcludingSelf).

produceAccumulator

function to create the result collection with an initial capacity.

predicate

the filter applied to each field entry.

transform

the mapping function applied to each matching entry.


inline fun <ID : Any, T, R, C : MutableCollection<R>> Field<ID, T>.collectInto(accumulator: C, reductionType: ReductionType = ExcludingSelf, crossinline predicate: Predicate<FieldEntry<ID, T>>, crossinline transform: (FieldEntry<ID, T>) -> R): C

Collects the field entries that satisfy the given predicate, transforms them using transform, and stores the results in the provided accumulator.

By default, the local entry is excluded from the result. It is included only if reductionType is it.unibo.collektive.stdlib.util.IncludingSelf.

Return

the same accumulator with the transformed entries added.

Parameters

accumulator

the collection into which results are stored.

reductionType

specifies whether to include the local entry (default is ExcludingSelf).

predicate

the filter applied to each field entry.

transform

the mapping function applied to each matching entry.