Wraps value in an Option type, depending on whether or not value is null @param value the value to wrap in Option @param the type of value @return Some(value) if value is not null, None if value is null
(T value)
| 118 | * @return Some(value) if value is not null, None if value is null |
| 119 | */ |
| 120 | public static <T> Option<T> fromNullable(T value) { |
| 121 | if (value != null) { |
| 122 | return some(value); |
| 123 | } else { |
| 124 | return none(); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Wrap value in a Some type (NB! value must not be null!) |