ofNullable

fun <T> ofNullable(value: T?): Optional<T?>

Returns an Optional describing the given value, if non-null, otherwise returns an empty Optional.

Return

an Optional with a present value if the specified value is non-null, otherwise an empty Optional

Parameters

value

the possibly-null value to describe

the type of the value