Optional.orElse

Gets the value of this optional if it exists, otherwise uses a given default value.

struct Optional(T)
T
orElse

Parameters

defaultValue T

The value to return if no default value exists.

Return Value

Type: T

The value of the optional, or the default value if this optional is empty.