Package com.tngtech.archunit.base
Class Optional<T>
java.lang.Object
com.tngtech.archunit.base.Optional<T>
@PublicAPI(usage=ACCESS) public abstract class Optional<T> extends java.lang.Object
-
Method Summary
Modifier and Type Method Description static <T> Optional<T>
absent()
Deprecated.abstract java.util.Set<T>
asSet()
static <T> Optional<T>
empty()
static <T> Optional<T>
fromNullable(T object)
Deprecated.useofNullable(Object)
insteadabstract T
get()
T
getOrThrow(Supplier<? extends java.lang.RuntimeException> exceptionSupplier)
Deprecated.UseorElseThrow(Supplier)
insteadabstract T
getOrThrow(java.lang.RuntimeException e)
Deprecated.UsegetOrThrow(Supplier)
instead (this version always instantiates the exception, no matter if needed)abstract boolean
isPresent()
abstract <U> Optional<U>
map(Function<? super T,? extends U> mapper)
static <T> Optional<T>
of(T object)
static <T> Optional<T>
ofNullable(T object)
abstract Optional<T>
or(Optional<? extends T> value)
Deprecated.This method will be removed in the future, useorElseGet(Supplier)
instead.T
or(T value)
Deprecated.UseorElse(Object)
instead.abstract T
orElse(T other)
abstract T
orElseGet(Supplier<? extends T> supplier)
abstract <X extends java.lang.Throwable>
TorElseThrow(Supplier<? extends X> exceptionSupplier)
T
orNull()
Deprecated.UseorElse(null)
instead.<U> Optional<U>
transform(Function<? super T,U> function)
Deprecated.Usemap(Function)
instead.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
of
-
fromNullable
Deprecated.useofNullable(Object)
instead -
ofNullable
-
absent
Deprecated.useempty()
instead -
empty
-
isPresent
-
get
-
getOrThrow
Deprecated.UsegetOrThrow(Supplier)
instead (this version always instantiates the exception, no matter if needed) -
getOrThrow
@Deprecated @PublicAPI(usage=ACCESS) public T getOrThrow(Supplier<? extends java.lang.RuntimeException> exceptionSupplier)Deprecated.UseorElseThrow(Supplier)
instead -
orElseThrow
@PublicAPI(usage=ACCESS) public abstract <X extends java.lang.Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X extends java.lang.Throwable- Throws:
X extends java.lang.Throwable
-
transform
@Deprecated @PublicAPI(usage=ACCESS) public <U> Optional<U> transform(Function<? super T,U> function)Deprecated.Usemap(Function)
instead. -
map
-
orNull
Deprecated.UseorElse(null)
instead. -
or
Deprecated.UseorElse(Object)
instead. -
orElse
-
orElseGet
-
or
Deprecated.This method will be removed in the future, useorElseGet(Supplier)
instead. -
asSet
-
empty()
instead