ifPresentOrElse

open fun ifPresentOrElse(@NonNull consumer: Consumer<V>, @NonNull 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