whatIfNotNull

inline fun <T> T?.whatIfNotNull(whatIf: (T) -> Unit): T?

An expression for invoking whatIf when the T target object is not null.

Return

Returns the desired type of object.

Parameters

whatIf

An executable lambda if a target object is not null.

inline fun <T> T?.whatIfNotNull(whatIf: (T) -> Unit, whatIfNot: () -> Unit): T?

An expression for invoking whatIf when the T target object is not null. If the T target is null, whatIfNot will be invoked instead of the whatIf.

Return

Returns the desired type of object.

Parameters

whatIf

An executable lambda if a target object is not null.

whatIfNot

An executable lambda if a target object is null.