T - the type of the value.public interface Optional<T>
Optional this an interface, so custom implementations can be developed.| Modifier and Type | Method and Description |
|---|---|
boolean |
isPresent()
Returns whether the optional value is present.
|
T |
value()
Returns the optional value.
|
boolean isPresent()
true if the value is present, false otherwise.T value() throws java.util.NoSuchElementException
java.util.NoSuchElementException - if the optional value is not present.