Creates an Optional from a nullable value. If the value is null, returns an empty Optional; otherwise wraps the value.
Example:
string? name = "Alice";
var opt = Optional.ofNullable<string> (name);
assert (opt.isPresent ());
| value |
the possibly-null value. |
|
an Optional containing the value, or empty if null. |