ifPresentOrElse

open fun ifPresentOrElse(consumer: Consumer<V>, runnable: Runnable)

Runs the consumer on the value of the reference if it is not null. If the reference is null, the given runnable is run.

Parameters

consumer

the consumer to run

runnable

the runnable to run if the reference is null