Get the contained value (if defined) or else return a default value @param other what to return if the value is not defined (a None) @return either the value, or other if the value is not defined
(T other)
| 50 | * @return either the value, or other if the value is not defined |
| 51 | */ |
| 52 | public T or(T other) { |
| 53 | if (isDefined()) { |
| 54 | return get(); |
| 55 | } else { |
| 56 | return other; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Turn this Option into Java 8 Optional type |