T - @Immutable public static final class u.Nullable<T> extends Object implements Immutable
| Modifier and Type | Field and Description |
|---|---|
static u.Nullable<Boolean> |
FALSE
Presents
Boolean.FALSE. |
static u.Nullable<Boolean> |
TRUE
Presents
Boolean.TRUE. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(T element) |
static <T> u.Nullable<T> |
empty() |
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.
|
<U,E extends Exception> |
flatMap(Throwables.Function<? super T,u.Nullable<U>,E> mapper) |
<U,E extends Exception> |
flatMapIfNotNull(Throwables.Function<? super T,u.Nullable<U>,E> mapper)
Flat map if not null.
|
static <T> u.Nullable<T> |
from(u.Optional<T> optional) |
T |
get() |
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.
|
<E extends Exception> |
ifPresent(Throwables.Consumer<? super T,E> action) |
<E extends Exception,E2 extends Exception> |
ifPresentOrElse(Throwables.Consumer<? super T,E> action,
Throwables.Runnable<E2> emptyAction)
If present or else.
|
boolean |
isEmpty()
Deprecated.
replaced by
isNotPresent() |
boolean |
isNotNull()
Returns
true if the value is present and it's not null, otherwise returns false. |
boolean |
isNotPresent()
Returns
true if the value is not present, otherwise returns false. |
boolean |
isNull()
Returns
true if the value is not present, or it is present but it's null, otherwise returns false. |
boolean |
isPresent()
Returns
true if the value is present, otherwise returns false. |
<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.
|
<E extends Exception> |
mapToBoolean(Throwables.ToBooleanFunction<? super T,E> mapper)
Map to boolean.
|
<E extends Exception> |
mapToBooleanIfNotNull(Throwables.ToBooleanFunction<? super T,E> mapper)
Map to boolean if not null.
|
<E extends Exception> |
mapToByte(Throwables.ToByteFunction<? super T,E> mapper)
Map to byte.
|
<E extends Exception> |
mapToByteIfNotNull(Throwables.ToByteFunction<? super T,E> mapper)
Map to byte if not null.
|
<E extends Exception> |
mapToChar(Throwables.ToCharFunction<? super T,E> mapper)
Map to char.
|
<E extends Exception> |
mapToCharIfNotNull(Throwables.ToCharFunction<? super T,E> mapper)
Map to char if not null.
|
<E extends Exception> |
mapToDouble(Throwables.ToDoubleFunction<? super T,E> mapper)
Map to double.
|
<E extends Exception> |
mapToDoubleIfNotNull(Throwables.ToDoubleFunction<? super T,E> mapper)
Map to double if not null.
|
<E extends Exception> |
mapToFloat(Throwables.ToFloatFunction<? super T,E> mapper)
Map to float.
|
<E extends Exception> |
mapToFloatIfNotNull(Throwables.ToFloatFunction<? super T,E> mapper)
Map to float if not null.
|
<E extends Exception> |
mapToInt(Throwables.ToIntFunction<? super T,E> mapper)
Map to int.
|
<E extends Exception> |
mapToIntIfNotNull(Throwables.ToIntFunction<? super T,E> mapper)
Map to int if not null.
|
<E extends Exception> |
mapToLong(Throwables.ToLongFunction<? super T,E> mapper)
Map to long.
|
<E extends Exception> |
mapToLongIfNotNull(Throwables.ToLongFunction<? super T,E> mapper)
Map to long if not null.
|
<U,E extends Exception> |
mapToNonNull(Throwables.Function<? super T,? extends U,E> mapper) |
<U,E extends Exception> |
mapToNonNullIfNotNull(Throwables.Function<? super T,? extends U,E> mapper)
Map if not null.
|
<E extends Exception> |
mapToShort(Throwables.ToShortFunction<? super T,E> mapper)
Map to short.
|
<E extends Exception> |
mapToShortIfNotNull(Throwables.ToShortFunction<? super T,E> mapper)
Map to short if not null.
|
static u.Nullable<String> |
of(String value) |
static <T> u.Nullable<T> |
of(T value) |
<E extends Exception> |
or(Throwables.Supplier<u.Nullable<? extends T>,E> supplier) |
T |
orElse(T other) |
<E extends Exception> |
orElseGet(Throwables.Supplier<? extends T,E> other)
Or else get.
|
<E extends Exception> |
orElseGetIfNull(Throwables.Supplier<? extends T,E> other)
Or else get if null.
|
T |
orElseIfNull(T other)
Or else if null.
|
T |
orElseThrow()
Or else throw.
|
<X extends Throwable> |
orElseThrow(Supplier<? extends X> exceptionSupplier)
Or else throw.
|
T |
orElseThrowIfNull()
Or else throw if null.
|
<X extends Throwable> |
orElseThrowIfNull(Supplier<? extends X> exceptionSupplier)
Or else throw if null.
|
<E extends Exception> |
orIfNull(Throwables.Supplier<u.Nullable<? extends T>,E> supplier)
Or if null.
|
T |
orNull() |
ImmutableList<T> |
toImmutableList()
To immutable list.
|
ImmutableList<T> |
toImmutableListIfNotNull()
To immutable list if not null.
|
ImmutableSet<T> |
toImmutableSet()
To immutable set.
|
ImmutableSet<T> |
toImmutableSetIfNotNull()
To immutable set if not null.
|
List<T> |
toList() |
List<T> |
toListIfNotNull()
To list if not null.
|
u.Optional<T> |
toOptional() |
Set<T> |
toSet() |
Set<T> |
toSetIfNotNull()
To set if not null.
|
String |
toString() |
public static final u.Nullable<Boolean> TRUE
Boolean.TRUE.public static final u.Nullable<Boolean> FALSE
Boolean.FALSE.public static <T> u.Nullable<T> empty()
T - public static u.Nullable<String> of(String value)
public static <T> u.Nullable<T> of(T value)
T - value - public static <T> u.Nullable<T> from(u.Optional<T> optional)
T - optional - public T get() throws NoSuchElementException
NoSuchElementException - the no such element exceptionpublic boolean isPresent()
true if the value is present, otherwise returns false.public boolean isNotPresent()
true if the value is not present, otherwise returns false.@Deprecated public boolean isEmpty()
isNotPresent()true if the value is not present, otherwise returns false.public boolean isNull()
true if the value is not present, or it is present but it's null, otherwise returns false.public boolean isNotNull()
true if the value is present and it's not null, otherwise returns false.public <E extends Exception> u.Nullable<T> ifPresent(Throwables.Consumer<? super T,E> action) throws E extends Exception
E - action - E - the eE extends Exceptionpublic <E extends Exception,E2 extends Exception> u.Nullable<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 Exceptionpublic <E extends Exception> u.Nullable<T> ifNotNull(Throwables.Consumer<? super T,E> action) throws E extends Exception
E - action - E - the eE extends Exceptionpublic <E extends Exception,E2 extends Exception> u.Nullable<T> 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> 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 <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 Exceptionpublic <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 Exceptionpublic <E extends Exception> u.OptionalBoolean mapToBoolean(Throwables.ToBooleanFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalChar mapToChar(Throwables.ToCharFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalByte mapToByte(Throwables.ToByteFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalShort mapToShort(Throwables.ToShortFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalInt mapToInt(Throwables.ToIntFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalLong mapToLong(Throwables.ToLongFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalFloat mapToFloat(Throwables.ToFloatFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalDouble mapToDouble(Throwables.ToDoubleFunction<? super T,E> mapper) throws E extends Exception
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
U - E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalBoolean mapToBooleanIfNotNull(Throwables.ToBooleanFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalChar mapToCharIfNotNull(Throwables.ToCharFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalByte mapToByteIfNotNull(Throwables.ToByteFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalShort mapToShortIfNotNull(Throwables.ToShortFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalInt mapToIntIfNotNull(Throwables.ToIntFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalLong mapToLongIfNotNull(Throwables.ToLongFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalFloat mapToFloatIfNotNull(Throwables.ToFloatFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <E extends Exception> u.OptionalDouble mapToDoubleIfNotNull(Throwables.ToDoubleFunction<? super T,E> mapper) throws E extends Exception
E - mapper - E - the eE extends Exceptionpublic <U,E extends Exception> u.Nullable<U> flatMap(Throwables.Function<? super T,u.Nullable<U>,E> mapper) throws E extends Exception
U - E - mapper - E - the eE extends Exceptionpublic <U,E extends Exception> u.Nullable<U> flatMapIfNotNull(Throwables.Function<? super T,u.Nullable<U>,E> mapper) throws E extends Exception
U - E - mapper - E - the eE extends Exceptionpublic boolean contains(T element)
public <E extends Exception> u.Nullable<T> or(Throwables.Supplier<u.Nullable<? extends T>,E> supplier) throws E extends Exception
E - supplier - E - the eE extends Exceptionpublic <E extends Exception> u.Nullable<T> orIfNull(Throwables.Supplier<u.Nullable<? extends T>,E> supplier) throws E extends Exception
E - supplier - E - the eE extends Exceptionpublic T orNull()
public <E extends Exception> T orElseGet(Throwables.Supplier<? extends T,E> other) throws E extends Exception
E - other - E - the eE extends Exceptionpublic 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 Throwablepublic <E extends Exception> T orElseGetIfNull(Throwables.Supplier<? extends T,E> other) throws E extends Exception
E - other - E - the eE extends Exceptionpublic T orElseThrowIfNull() throws NoSuchElementException
NoSuchElementException - the no such element exceptionpublic <X extends Throwable> T orElseThrowIfNull(Supplier<? extends X> exceptionSupplier) throws X extends Throwable
X - exceptionSupplier - X - the xX extends Throwablepublic ImmutableList<T> toImmutableList()
public ImmutableList<T> toImmutableListIfNotNull()
public ImmutableSet<T> toImmutableSet()
public ImmutableSet<T> toImmutableSetIfNotNull()
public u.Optional<T> toOptional()
public boolean equals(Object obj)
Copyright © 2021. All rights reserved.