/** * Creates a new {@code Some} of a given value. * <p> * The only difference to {@link Option#of(Object)} is, when called with argument {@code null}. * <pre> * <code> * Option.of(null); // = None * Option.some(null); // = Some(null) * </code> * </pre> * * @param value A value * @param <T> type of the value * @return {@code Some(value)} */ static <T> Option<T> some(T value) { return new Some<>(value); }
@Unapply static <T> Tuple1<T> Some(Option.Some<T> some) { return Tuple.of(some.get()); } @Unapply
@Override public String toString() { return stringPrefix() + "(" + value + ")"; } }
/** * Creates a new {@code Some} of a given value. * <p> * The only difference to {@link Option#of(Object)} is, when called with argument {@code null}. * <pre> * <code> * Option.of(null); // = None * Option.some(null); // = Some(null) * </code> * </pre> * * @param value A value * @param <T> type of the value * @return {@code Some(value)} */ static <T> Option<T> some(T value) { return new Some<>(value); }
@Unapply static <T> Tuple1<T> Some(Option.Some<T> some) { return Tuple.of(some.get()); } @Unapply
@Override public String toString() { return stringPrefix() + "(" + value + ")"; } }