addOrReplace

fun <T> MutableList<T>.addOrReplace(item: T, predicate: (T) -> Boolean): Boolean

Replaces the first item within the list that matches the given predicate or adds the item to the list if none match.