takeIf

inline fun <T> T.takeIf(predicate: (T) -> Boolean): T? (source)

Platform and version requirements: Kotlin 1.1

Returns this value if it satisfies the given predicate or null, if it doesn't.