ifNotNull

infix inline fun Any?.ifNotNull(block: Block)

evaluates a block if the receiver object is not null.

Parameters

<receiver>

Any?

block

block of code to execute if not null

inline fun Any?.ifNotNull(block: Block, otherwise: Block)

evaluates first block if receiver object is not null, otherwise evaluates the second block.

Parameters

<receiver>

Any?

block

block of code to execute if not null

otherwise

alternative block of code to execute if null