v1.0
The Optional<T>
is a wrapper for read operations to handle
cases where the query result may be null.
Name | Description |
---|
HasValue | Indicates whether the current Optional<T> object has a value or not. |
Value | Gets the value of the current Optional<T> object. |
Name | Description | Parameters |
---|
Of(value) | Creates a new Optional<T> object with the specified value. | value : The value to wrap. |
OfNullable(value) | Creates a new Optional<T> object with the specified value. | value : The value to wrap. |
Name | Description | Parameters |
---|
OrElse(fallback) | Returns the value of the current Optional<T> object, or the specified fallback value if the current object has no value. | fallback : The fallback value. |
OrElseThrow(exceptionSupplier) | Returns the value of the current Optional<T> object, or throws the specified exception if the current object has no value. | exceptionSupplier : A Func<Exception> that returns the exception to throw. |
IfNullThen(callbackAction) | Executes the specified action if the current Optional<T> object has no value. | callbackAction : The action to execute. |