addOrReplace

@ApiStatus.Internal
fun <E> MutableList<E>.addOrReplace(element: E): E?

Replace this given element if it already exists in this list using Any.equals, or append it to the end if it does not. This method is very strange and has one specific use case, which is for cases where referential equality is needed as well as structural equality. See more here.

Since

1.2.0

See also