Optional
Main
The optional class lets you handle possible null values in a programatic way, this way, you can avoid the use of multiple if
statements in your code. This plugin has been inspired by Optinal from Java 8.
Methods
Method | Description |
of | Creates a new optional from a value |
ofNullable | Creates a new optional from a value, if value is not present or null then it creates an empty instance of Optional. |
ifPresent | Returns a boolean value. True if value is present (not null), otherwise false. |
get | Returns value of Optional. |
orElseGet | Tries to get the |
orElseThrows | Tries to get the |
Usage
Last updated