| Constructor and Description |
|---|
Holder()
Instantiates a new holder.
|
| Modifier and Type | Method and Description |
|---|---|
<E extends Exception> |
accept(Throwables.Consumer<? super T,E> action) |
<E extends Exception> |
acceptIfNotNull(Throwables.Consumer<? super T,E> action)
Deprecated.
|
boolean |
equals(Object obj) |
<E extends Exception> |
filter(Throwables.Predicate<? super T,E> predicate) |
<E extends Exception> |
filterIfNotNull(Throwables.Predicate<? super T,E> predicate)
Filter if not null.
|
T |
getAndSet(T value)
Gets the and set.
|
<E extends Exception> |
getAndUpdate(Throwables.UnaryOperator<T,E> updateFunction)
Gets the and update.
|
T |
getValue()
Deprecated.
replace by
value(). |
int |
hashCode() |
<E extends Exception> |
ifNotNull(Throwables.Consumer<? super T,E> action)
If not null.
|
<E extends Exception,E2 extends Exception> |
ifNotNullOrElse(Throwables.Consumer<? super T,E> action,
Throwables.Runnable<E2> emptyAction)
If not null or else.
|
boolean |
isNotNull()
Checks if is not null.
|
boolean |
isNull()
Checks if is null.
|
<U,E extends Exception> |
map(Throwables.Function<? super T,? extends U,E> mapper) |
<U,E extends Exception> |
mapIfNotNull(Throwables.Function<? super T,? extends U,E> mapper)
Map if not null.
|
<U,E extends Exception> |
mapToNonNullIfNotNull(Throwables.Function<? super T,? extends U,E> mapper) |
static <T> u.Holder<T> |
of(T value) |
<E extends Exception> |
orElseGetIfNull(Throwables.Supplier<? extends T,E> other)
Or else get if null.
|
T |
orElseIfNull(T other)
Or else if null.
|
<X extends Throwable> |
orElseThrowIfNull(Supplier<? extends X> exceptionSupplier)
Or else throw if null.
|
T |
setAndGet(T value)
Sets the and get.
|
<E extends Exception> |
setIf(T newValue,
Throwables.BiPredicate<? super T,? super T,E> predicate)
Deprecated.
|
<E extends Exception> |
setIf(T newValue,
Throwables.Predicate<? super T,E> predicate)
Set with the specified new value and returns
true if predicate returns true. |
void |
setValue(T value)
Sets the value.
|
u.Nullable<T> |
toNullable()
Returns a non-empty
Nullable with the value. |
u.Optional<T> |
toOptional()
Returns an
Optional with the value if value is not null, otherwise an empty Optional is returned. |
String |
toString() |
<E extends Exception> |
updateAndGet(Throwables.UnaryOperator<T,E> updateFunction)
Update and get.
|
T |
value() |
public static <T> u.Holder<T> of(T value)
T - value - public T value()
@Deprecated public T getValue()
value().public void setValue(T value)
value - the new valuepublic T getAndSet(T value)
value - public T setAndGet(T value)
value - public final <E extends Exception> T getAndUpdate(Throwables.UnaryOperator<T,E> updateFunction) throws E extends Exception
E - updateFunction - E - the eE extends Exceptionpublic final <E extends Exception> T updateAndGet(Throwables.UnaryOperator<T,E> updateFunction) throws E extends Exception
E - updateFunction - E - the eE extends Exceptionpublic <E extends Exception> boolean setIf(T newValue, Throwables.Predicate<? super T,E> predicate) throws E extends Exception
true if predicate returns true.
Otherwise just return false without setting the value to new value.E - newValue - predicate - - test the current value.E - the eE extends Exception@Deprecated public <E extends Exception> boolean setIf(T newValue, Throwables.BiPredicate<? super T,? super T,E> predicate) throws E extends Exception
true if predicate returns true.
Otherwise just return false without setting the value to new value.E - newValue - predicate - the first parameter is the current value, the second parameter is the new value.E - the eE extends Exceptionpublic boolean isNull()
public boolean isNotNull()
public <E extends Exception> void ifNotNull(Throwables.Consumer<? super T,E> action) throws E extends Exception
E - action - E - the eE extends Exceptionpublic <E extends Exception,E2 extends Exception> void ifNotNullOrElse(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 Exceptionpublic <E extends Exception> void accept(Throwables.Consumer<? super T,E> action) throws E extends Exception
E - action - E - the eE extends Exception@Deprecated public <E extends Exception> void acceptIfNotNull(Throwables.Consumer<? super T,E> action) throws E extends Exception
ifNotNull(com.landawn.abacus.util.Throwables.Consumer)E - action - E - the eE extends Exceptionpublic <U,E extends Exception> U map(Throwables.Function<? super T,? extends U,E> mapper) throws E extends Exception
U - E - mapper - E - the eE extends Exceptionpublic <U,E extends Exception> u.Nullable<U> mapIfNotNull(Throwables.Function<? super T,? extends U,E> mapper) throws E extends Exception
U - E - mapper - E - the eE extends Exceptionpublic <U,E extends Exception> u.Optional<U> mapToNonNullIfNotNull(Throwables.Function<? super T,? extends U,E> mapper) throws E extends Exception
E extends Exceptionpublic <E extends Exception> u.Nullable<T> filter(Throwables.Predicate<? super T,E> predicate) throws E extends Exception
E - predicate - E - the eE extends Exceptionpublic <E extends Exception> u.Optional<T> filterIfNotNull(Throwables.Predicate<? super T,E> predicate) throws E extends Exception
E - predicate - E - the eE extends Exceptionpublic T orElseIfNull(T other)
other - public <E extends Exception> T orElseGetIfNull(Throwables.Supplier<? extends T,E> other) throws E extends Exception
E - other - E - the eE extends Exceptionpublic <X extends Throwable> T orElseThrowIfNull(Supplier<? extends X> exceptionSupplier) throws X extends Throwable
X - exceptionSupplier - X - the xX extends Throwablepublic u.Nullable<T> toNullable()
Nullable with the value.public u.Optional<T> toOptional()
Optional with the value if value is not null, otherwise an empty Optional is returned.public boolean equals(Object obj)
Copyright © 2021. All rights reserved.