updateIf

inline fun <T> T.updateIf(predicate: (T) -> Boolean, update: (T) -> T): T

Returns the updated value if this matches predicate, or this if not. This is very helpful in the linked operations.

Usage example:

val content = list
.joinToString()
.updateIf({ it.any() }){ "$it." }