Package org.apache.el.stream
Class Optional
java.lang.Object
org.apache.el.stream.Optional
Represents an optional value that may or may not be present.
-
Method Summary
Modifier and TypeMethodDescriptionget()Returns the contained value, or throws an exception if empty.voidIf a value is present, invokes the given lambda with the value.Returns the contained value, or the given default value if empty.Returns the contained value, or the result of evaluating the given lambda if empty.
-
Method Details
-
get
Returns the contained value, or throws an exception if empty.- Returns:
- The contained value
- Throws:
ELException- if the value is not present
-
ifPresent
If a value is present, invokes the given lambda with the value.- Parameters:
le- The lambda expression to invoke
-
orElse
Returns the contained value, or the given default value if empty.- Parameters:
other- The default value- Returns:
- The contained value or the default
-
orElseGet
Returns the contained value, or the result of evaluating the given lambda if empty.- Parameters:
le- The lambda expression or already-evaluated value- Returns:
- The contained value or the result of the lambda
-