Package com.landawn.abacus.util
Class u.OptionalByte
java.lang.Object
com.landawn.abacus.util.u.OptionalByte
- All Implemented Interfaces:
Immutable
,Comparable<u.OptionalByte>
- Enclosing class:
- u
@Immutable
public static final class u.OptionalByte
extends Object
implements Comparable<u.OptionalByte>, Immutable
The Class OptionalByte.
-
Method Summary
Modifier and TypeMethodDescriptionboxed()
int
compareTo
(u.OptionalByte optional) static u.OptionalByte
empty()
boolean
<E extends Exception>
u.OptionalBytefilter
(Throwables.BytePredicate<E> predicate) <E extends Exception>
u.OptionalByteflatMap
(Throwables.ByteFunction<u.OptionalByte, E> mapper) byte
get()
int
hashCode()
<E extends Exception>
u.OptionalByteifPresent
(Throwables.ByteConsumer<E> action) <E extends Exception,
E2 extends Exception>
u.OptionalByteifPresentOrElse
(Throwables.ByteConsumer<E> action, Throwables.Runnable<E2> emptyAction) If present or else.boolean
isEmpty()
boolean
<E extends Exception>
u.OptionalBytemap
(Throwables.ByteUnaryOperator<E> mapper) <E extends Exception>
u.OptionalIntmapToInt
(Throwables.ToIntFunction<Byte, E> mapper) Map to int.<T,
E extends Exception>
u.Optional<T>mapToNonNull
(Throwables.ByteFunction<T, E> mapper) <T,
E extends Exception>
u.Nullable<T>mapToObj
(Throwables.ByteFunction<T, E> mapper) Map to obj.static u.OptionalByte
of
(byte value) static u.OptionalByte
ofNullable
(Byte val) <E extends Exception>
u.OptionalByteor
(Throwables.Supplier<u.OptionalByte, E> supplier) byte
orElse
(byte other) <E extends Exception>
byteorElseGet
(Throwables.ByteSupplier<E> other) Or else get.byte
Or else throw.<X extends Throwable>
byteorElseThrow
(Supplier<? extends X> exceptionSupplier) Or else throw.byte
byte
orZero()
Deprecated.stream()
To immutable list.To immutable set.toList()
toSet()
toString()
-
Method Details
-
empty
- Returns:
-
of
- Parameters:
value
-- Returns:
-
ofNullable
- Parameters:
val
-- Returns:
-
get
- Returns:
- Throws:
NoSuchElementException
- the no such element exception
-
isPresent
public boolean isPresent() -
isEmpty
public boolean isEmpty() -
ifPresent
- Type Parameters:
E
-- Parameters:
action
-- Returns:
- Throws:
E
- the e
-
ifPresentOrElse
public <E extends Exception,E2 extends Exception> u.OptionalByte ifPresentOrElse(Throwables.ByteConsumer<E> action, Throwables.Runnable<E2> emptyAction) throws E, E2 If present or else.- Type Parameters:
E
-E2
-- Parameters:
action
-emptyAction
-- Returns:
- Throws:
E
- the eE2
- the e2
-
filter
- Type Parameters:
E
-- Parameters:
predicate
-- Returns:
- Throws:
E
- the e
-
map
- Type Parameters:
E
-- Parameters:
mapper
-- Returns:
- Throws:
E
- the e
-
mapToInt
public <E extends Exception> u.OptionalInt mapToInt(Throwables.ToIntFunction<Byte, E> mapper) throws EMap to int.- Type Parameters:
E
-- Parameters:
mapper
-- Returns:
- Throws:
E
- the e
-
mapToObj
public <T,E extends Exception> u.Nullable<T> mapToObj(Throwables.ByteFunction<T, E> mapper) throws EMap to obj.- Type Parameters:
T
-E
-- Parameters:
mapper
-- Returns:
- Throws:
E
- the e
-
mapToNonNull
public <T,E extends Exception> u.Optional<T> mapToNonNull(Throwables.ByteFunction<T, E> mapper) throws E- Throws:
E extends Exception
-
flatMap
public <E extends Exception> u.OptionalByte flatMap(Throwables.ByteFunction<u.OptionalByte, E> mapper) throws E- Type Parameters:
E
-- Parameters:
mapper
-- Returns:
- Throws:
E
- the e
-
or
public <E extends Exception> u.OptionalByte or(Throwables.Supplier<u.OptionalByte, E> supplier) throws E- Type Parameters:
E
-- Parameters:
supplier
-- Returns:
- Throws:
E
- the e
-
orZero
Deprecated.useorElseZero()
- Returns:
-
orElseZero
public byte orElseZero() -
orElse
public byte orElse(byte other) - Parameters:
other
-- Returns:
-
orElseGet
Or else get.- Type Parameters:
E
-- Parameters:
other
-- Returns:
- Throws:
E
- the e
-
orElseThrow
Or else throw.- Returns:
- Throws:
NoSuchElementException
- the no such element exception
-
orElseThrow
Or else throw.- Type Parameters:
X
-- Parameters:
exceptionSupplier
-- Returns:
- Throws:
X
- the x
-
stream
- Returns:
-
toList
- Returns:
-
toSet
- Returns:
-
toImmutableList
To immutable list.- Returns:
-
toImmutableSet
To immutable set.- Returns:
-
boxed
- Returns:
-
compareTo
- Specified by:
compareTo
in interfaceComparable<u.OptionalByte>
- Parameters:
optional
-- Returns:
-
equals
-
hashCode
public int hashCode() -
toString
-
orElseZero()