Private constructorPrivate Optional Readonly valueFilter the Optional. If the Optional is empty or the predicate returns false, this will return an empty Optional.
A function that takes the Optional's value and returns a boolean.
The Optional if the predicate returns true, an empty Optional otherwise.
Get the value of the Optional, or the result of the executor if the Optional is empty.
A function that returns a value if the Optional is empty.
The value of the Optional, or the result of the executor if the Optional is empty.
Get the value of the Optional, or throw an error if the Optional is empty.
A function that takes an error and returns an error.
The value of the Optional.
Execute the consumer with the value of the Optional if the Optional is present. If the Optional is empty, this will do nothing.
A function that takes the Optional's value.
The Optional.
Map the Optional to a new Optional, with the value transformed by the executor. If the Optional is empty, this will return an empty Optional.
A function that takes the Optional's value and returns a new value.
A new Optional with the mapped value, or an empty Optional if this Optional is empty.
Static emptyStatic ofGenerated using TypeDoc
An Optional is a container that may or may not contain a value.
Example