replaceMatching

inline fun <ID : Any, T> Field<ID, T>.replaceMatching(replacement: T, crossinline predicate: Predicate<FieldEntry<ID, T>>): Field<ID, T>

Returns a new field where each entry matching the given predicate is replaced with replacement.

Entries that do not satisfy the predicate retain their original value. The local entry is included in the check.

Return

a new field with values replaced where the predicate is satisfied.

Parameters

replacement

the value to assign to matching entries.

predicate

the condition used to determine which entries to replace.