Returns an Optional instance containing the given non-null reference. To have null treated as #absent, use #fromNullable instead. Comparison to java.util.Optional: no differences. @throws NullPointerException if reference is null
(T reference)
| 104 | * @throws NullPointerException if {@code reference} is null |
| 105 | */ |
| 106 | public static <T> Optional<T> of(T reference) { |
| 107 | return new Present<T>(checkNotNull(reference)); |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * If {@code nullableReference} is non-null, returns an {@code Optional} instance containing that |
no test coverage detected