guava/src/com/google/common/base/Optional.java
public static <T> Optional<T> fromNullable(@Nullable T nullableReference) {
    return (nullableReference == null) ? Optional.<T>absent() : new Present<T>(nullableReference);
  }
public static <T> Optional<T> fromNullable(@Nullable T nullableReference) {
    return (nullableReference == null) ? Optional.<T>absent() : new Present<T>(nullableReference);
  }
If {@code nullableReference} is non-null, returns an {@code Optional} instance containing that
reference; otherwise returns {@link Optional#absent}.

<p><b>Comparison to {@code java.util.Optional}:</b> this method is equivalent to Java 8's
{@code Optional.ofNullable}.