ifPresent

fun ifPresent(action: (T) -> Unit)

If a value is present, performs the given action with the value, otherwise does nothing.

Parameters

action

the action to be performed if a value is present. (Note: in Kotlin, the function type (T) -> Unit cannot be null.)