Package com.onslip360
Class Erasable<T>
- java.lang.Object
-
- com.onslip360.Erasable<T>
-
public class Erasable<T> extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<T>
asOptional()
static <T> Erasable<T>
empty()
boolean
equals(Object obj)
Erasable<T>
filter(Predicate<? super T> predicate)
<U> Erasable<U>
flatMap(Function<? super T,? extends Optional<? extends U>> mapper)
T
get()
int
hashCode()
void
ifPresent(Consumer<? super T> action)
void
ifPresentOrElse(Consumer<? super T> action, Runnable emptyAction)
boolean
isEmpty()
boolean
isNil()
static boolean
isNil(Object erasable)
boolean
isPresent()
<U> Erasable<U>
map(Function<? super T,? extends U> mapper)
static <T> Erasable<T>
nil()
static <T> Erasable<T>
nilOr(T value)
static <T> Erasable<T>
of(T value)
static <T> Erasable<T>
ofErasable(Erasable<T> value)
static <T> Erasable<T>
ofNullable(T value)
static <T> Erasable<T>
ofOptional(Optional<T> value)
Erasable<T>
or(Supplier<? extends Optional<? extends T>> supplier)
T
orElse(T other)
T
orElseGet(Supplier<? extends T> supplier)
T
orElseThrow()
<X extends Throwable>
TorElseThrow(Supplier<? extends X> exceptionSupplier)
Stream<T>
stream()
String
toString()
-
-
-
Method Detail
-
nil
@Nonnull public static <T> Erasable<T> nil()
-
empty
@Nonnull public static <T> Erasable<T> empty()
-
of
@Nonnull public static <T> Erasable<T> of(T value)
-
nilOr
@Nonnull public static <T> Erasable<T> nilOr(T value)
-
ofNullable
@Nonnull public static <T> Erasable<T> ofNullable(@Nullable T value)
-
get
@Nonnull public T get()
-
isPresent
public boolean isPresent()
-
isEmpty
public boolean isEmpty()
-
isNil
public boolean isNil()
-
isNil
public static boolean isNil(@Nullable Object erasable)
-
flatMap
@Nonnull public <U> Erasable<U> flatMap(Function<? super T,? extends Optional<? extends U>> mapper)
-
orElseThrow
@Nonnull public T orElseThrow()
-
orElseThrow
@Nonnull public <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X extends Throwable
- Throws:
X extends Throwable
-
-