takeIf

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

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

For detailed usage information see the documentation for scope functions.

Since Kotlin

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

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

For detailed usage information see the documentation for scope functions.

Since Kotlin

1.1