Class Optional<T>

java.lang.Object
io.dingodb.sdk.common.utils.Optional<T>

public class Optional<T> extends Object
  • Method Details

    • of

      public static <T> Optional<T> of(Optional optional)
    • of

      public static <T> Optional<T> of(T value)
    • ofNullable

      public static <T> Optional<T> ofNullable(T value)
    • ofNullable

      public static <T> Optional<T> ofNullable(T value, Supplier<T> supplier)
    • or

      public static <T> void or(T value, Consumer<T> present)
    • or

      public static <T> void or(T value, Consumer<T> present, Runnable absent)
    • or

      public static void or(Object value, Runnable present, Runnable absent)
    • empty

      public static <T> Optional<T> empty()
    • get

      public T get()
    • isAbsent

      public boolean isAbsent()
    • isPresent

      public boolean isPresent()
    • ifPresent

      public Optional<T> ifPresent(Consumer<? super T> consumer)
    • ifPresent

      public Optional<T> ifPresent(Runnable runnable)
    • ifPresent

      public static <T> void ifPresent(T value, Runnable runnable)
    • ifPresent

      public static <T> void ifPresent(T value, Consumer<? super T> consumer)
    • ifAbsent

      public Optional<T> ifAbsent(Runnable runnable)
    • ifAbsentThrow

      public void ifAbsentThrow(Supplier<RuntimeException> supplier)
    • ifAbsentSet

      public Optional<T> ifAbsentSet(T other)
    • ifAbsentSet

      public Optional<T> ifAbsentSet(Supplier<? extends T> other)
    • filter

      public Optional<T> filter(Predicate<? super T> predicate)
    • filter

      public Optional<T> filter(Supplier<Boolean> predicate)
    • filter

      public Optional<T> filter(boolean whether)
    • map

      public <U> Optional<U> map(Function<? super T,U> mapper)
    • flatMap

      public <U> Optional<U> flatMap(Function<? super T,Optional<T>> mapper)
    • orElse

      public <E extends Enum<E>> E orElse(E other)
    • orElse

      public short orElse(short other)
    • orElse

      public int orElse(int other)
    • orElse

      public long orElse(long other)
    • orElse

      public float orElse(float other)
    • orElse

      public double orElse(double other)
    • orElse

      public boolean orElse(boolean other)
    • orElse

      public char orElse(char other)
    • orElse

      public String orElse(String other)
    • mapOrNull

      public <U> U mapOrNull(Function<? super T,U> mapper)
    • mapOrNull

      public static <T, U> U mapOrNull(T value, Function<? super T,U> mapper)
    • mapOrGet

      public <U> U mapOrGet(Function<? super T,U> mapper, Supplier<U> other)
    • mapOrGet

      public static <T, U> U mapOrGet(T value, Function<? super T,? extends U> mapper, Supplier<U> other)
    • mapOrThrow

      public static <T, U> U mapOrThrow(T value, Function<? super T,? extends U> mapper, String message)
    • mapOrThrow

      public static <T, U, X extends Throwable> U mapOrThrow(T value, Function<? super T,? extends U> mapper, Supplier<? extends X> exceptionSupplier) throws X
      Throws:
      X extends Throwable
    • orNull

      public T orNull()
    • orElseGet

      public T orElseGet(Supplier<? extends T> other)
    • orElseThrow

      public T orElseThrow(String message)
    • orElseThrow

      public <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X
      Throws:
      X extends Throwable