Modifier and Type | Field and Description |
---|---|
static u.Optional<Boolean> |
FALSE
Presents
Boolean.FALSE . |
static u.Optional<Boolean> |
TRUE
Presents
Boolean.TRUE . |
public static final u.Optional<Boolean> TRUE
Boolean.TRUE
.public static final u.Optional<Boolean> FALSE
Boolean.FALSE
.public static <T> u.Optional<T> empty()
T
- public static <T> u.Optional<T> of(T value)
T
- value
- public static <T> u.Optional<T> ofNullable(T value)
T
- value
- public static <T> u.Optional<T> from(Optional<T> op)
T
- op
- public T get() throws NoSuchElementException
NoSuchElementException
- the no such element exceptionpublic boolean isPresent()
public boolean isEmpty()
public <E extends Exception> u.Optional<T> ifPresent(Throwables.Consumer<? super T,E> action) throws E extends Exception
E
- action
- E
- the eE extends Exception
public <E extends Exception,E2 extends Exception> u.Optional<T> ifPresentOrElse(Throwables.Consumer<? super T,E> action, Throwables.Runnable<E2> emptyAction) throws E extends Exception, E2 extends Exception
E
- E2
- action
- emptyAction
- E
- the eE2
- the e2E extends Exception
public <E extends Exception> u.Optional<T> filter(Throwables.Predicate<? super T,E> predicate) throws E extends Exception
E
- predicate
- E
- the eE extends Exception
public <U,E extends Exception> u.Nullable<U> map(Throwables.Function<? super T,? extends U,E> mapper) throws E extends Exception
U
- E
- mapper
- E
- the eE extends Exception
public <U,E extends Exception> u.Optional<U> mapToNonNull(Throwables.Function<? super T,? extends U,E> mapper) throws E extends Exception
U
- E
- mapper
- E
- the eE extends Exception
public <E extends Exception> u.OptionalBoolean mapToBoolean(Throwables.ToBooleanFunction<? super T,E> mapper) throws E extends Exception
E
- mapper
- E
- the eE extends Exception
public <E extends Exception> u.OptionalChar mapToChar(Throwables.ToCharFunction<? super T,E> mapper) throws E extends Exception
E
- mapper
- E
- the eE extends Exception
public <E extends Exception> u.OptionalByte mapToByte(Throwables.ToByteFunction<? super T,E> mapper) throws E extends Exception
E
- mapper
- E
- the eE extends Exception
public <E extends Exception> u.OptionalShort mapToShort(Throwables.ToShortFunction<? super T,E> mapper) throws E extends Exception
E
- mapper
- E
- the eE extends Exception
public <E extends Exception> u.OptionalInt mapToInt(Throwables.ToIntFunction<? super T,E> mapper) throws E extends Exception
E
- mapper
- E
- the eE extends Exception
public <E extends Exception> u.OptionalLong mapToLong(Throwables.ToLongFunction<? super T,E> mapper) throws E extends Exception
E
- mapper
- E
- the eE extends Exception
public <E extends Exception> u.OptionalFloat mapToFloat(Throwables.ToFloatFunction<? super T,E> mapper) throws E extends Exception
E
- mapper
- E
- the eE extends Exception
public <E extends Exception> u.OptionalDouble mapToDouble(Throwables.ToDoubleFunction<? super T,E> mapper) throws E extends Exception
E
- mapper
- E
- the eE extends Exception
public <U,E extends Exception> u.Optional<U> flatMap(Throwables.Function<? super T,u.Optional<U>,E> mapper) throws E extends Exception
U
- E
- mapper
- E
- the eE extends Exception
public boolean contains(T element)
public <E extends Exception> u.Optional<T> or(Throwables.Supplier<u.Optional<? extends T>,E> supplier) throws E extends Exception
E
- supplier
- E
- the eE extends Exception
public T orNull()
public <E extends Exception> T orElseGet(Throwables.Supplier<? extends T,E> other) throws E extends Exception
E
- other
- E
- the eE extends Exception
public T orElseThrow() throws NoSuchElementException
NoSuchElementException
- the no such element exceptionpublic <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X extends Throwable
X
- exceptionSupplier
- X
- the xX extends Throwable
public ImmutableList<T> toImmutableList()
public ImmutableSet<T> toImmutableSet()
public boolean equals(Object obj)
Copyright © 2020. All rights reserved.