clearThenAddAllNotNull

inline fun <T : MutableCollection<A>, A> T.clearThenAddAllNotNull(transform: (A) -> A?): T

Removes all elements in a collection and transforms them, leaving out any that are transformed to null.