replaceIf

inline fun <T> Iterable<T>.replaceIf(with: T, predicate: (T) -> Boolean): List<T>

Return

a new list, where each item that matches predicate is replaced with with


inline fun <T> Iterable<T>.replaceIf(apply: T.() -> T, predicate: (T) -> Boolean): List<T>

Return

a new list, where each item that matches predicate is replaced with the result of applying apply to it

Parameters

apply

a function that is applied on each item that matches predicate