If {@code nullable} is non-null, returns an {@code Option} instance containing that
reference; otherwise returns {@link Option#none}.
353747
public static <T> Option<T> from(T nullable) {
    return (null == nullable) ? Option.<T> none() : new Some<T>(nullable);
  }
1084706
public static <T> Optional<T> toJava(Option<T> scalaOption) {
		if (scalaOption.isEmpty()) {
			return Optional.empty();
		} else {
			return Optional.ofNullable(scalaOption.get());
		}
	}
1328043
public static <T> Predicate<T> notNull() {
        return new Predicate<T>() {
            @Override
            public boolean test(T testValue) {
                return testValue != null;
            }
        };
    }
121804
@CheckForNull
    public <T extends QEmuOption> T getOption(@Nonnull Class<T> type) {
        List<? extends T> options = getOptions(type);
        if (options.isEmpty())
            return null;
        return options.iterator().next();
    }
646000
public T get(@Nullable Map<FindOption<?>, ?> options) {
        if (options == null) {
            return defaultValue();
        }

        @SuppressWarnings("unchecked")
        final T value = (T) options.get(this);
        if (value == null) {
            return defaultValue();
        }

        return value;
    }
107574
public final Optional<R> asOptionalRight() {
		return fold(val -> Optional.<R> empty(), Optional::of);
	}
751861
public static Object getFirstOption(final List<?> options) {
		if (options != null) {
			for (Object option : options) {
				if (option instanceof OptionGroup) {
					List<?> groupOptions = ((OptionGroup) option).getOptions();
					if (groupOptions != null && !groupOptions.isEmpty()) {
						return groupOptions.get(0);
					}
				} else {
					return option;
				}
			}
		}
		return null;
	}
367787
public String getOptionValue(String opt)
    {
        String[] values = getOptionValues(opt);

        return (values == null) ? null : values[0];
    }
628608
private Option resolveOption(String opt)
    {
        opt = Util.stripLeadingHyphens(opt);
        for (Option option : options)
        {
            if (opt.equals(option.getOpt()))
            {
                return option;
            }

            if (opt.equals(option.getLongOpt()))
            {
                return option;
            }

        }
        return null;
    }
111909
public static <T> Optional<T> of(final T value) throws NullPointerException {
        if (value == null) {
            throw new NullPointerException("A null value was passed which is not allowed to be null."
                    + " Use #ofNullable(T) if the value can be null.");
        }
        return new Optional<T>(value);
    }
789907
public @Nullable <T> T findUniqueOrNull(@NotNull Class<T> cl, @NotNull @SQL String sql, Object... args) {
        return findOptional(cl, sql, args).orElse(null);
    }
45772
public static <V> Input<V> optional(@Nullable V value) {
    if (value == null) {
      return absent();
    } else {
      return fromNullable(value);
    }
  }
899464
private Option getOption(final String opt) {
        for (Object o : getOptions().getOptions()) {
            Option opto=(Option) o;
            if (opto.getOpt().equals(opt)) {
                return opto;
            }
        }
        return null;
    }
204728
public static <T> Choice<T> fromOptional(Optional<T> optional) {
    return optional.isPresent() ? of(optional.get()) : Choice.<T>none();
  }
948029
@Nonnull
  public static <T> T checkNotNull(@Nullable T obj) {
    return checkNotNull(obj, NPE_DEFAULT_MSG);
  }
1096812
public <T> T getOneOptional(Class<T> type, String name) {
		Object locator = find(name);
		return locator != null ? _references.getOneOptional(type, locator) : null;
	}
1135136
public @NotNull OptionalInt findOptionalInt(@NotNull @SQL String sql, Object... args) {
        return findOptionalInt(SqlQuery.query(sql, args));
    }