Package com.oracle.coherence.common.base
Interface Nullable<T>
- All Known Implementing Classes:
Binary,InflatableSet
public interface Nullable<T>
An interface that any class can implement to mark itself as "nullable",
which allows it to be used in a more optimal way with collections that
support "nullable" keys and/or values.
While technically not a marker interface, this interface can typically be
used as such as it provides a reasonable default implementation of the
get method that simply returns the instance itself.
The rest of the methods in this interface are static factory methods that
allow creation of a Nullable values from various primitive, wrapper
and reference types, as well as a static get(Nullable)
method that allows you to "unwrap" any Nullable and return either
the value itself or a null, if the specified Nullable is
empty.
- Since:
- 24.03
- Author:
- Aleks Seovic 2024.01.08
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Nullable<T> empty()Create an emptyNullablevalue.default Tget()Return the raw value of thisNullable.static <T> TReturn the value of the specifiedNullable.of(boolean value) Create aNullablerepresentation of the specifiedbooleanvalue.of(byte value) Create aNullablerepresentation of the specifiedbytevalue.of(double value) Create aNullablerepresentation of the specifieddoublevalue.of(float value) Create aNullablerepresentation of the specifiedfloatvalue.of(int value) Create aNullablerepresentation of the specifiedintvalue.of(long value) Create aNullablerepresentation of the specifiedlongvalue.of(short value) Create aNullablerepresentation of the specifiedshortvalue.Create aNullablerepresentation of the specifiedBooleanvalue.Create aNullablerepresentation of the specifiedBytevalue.Create aNullablerepresentation of the specifiedDoublevalue.Create aNullablerepresentation of the specifiedFloatvalue.Create aNullablerepresentation of the specifiedIntegervalue.Create aNullablerepresentation of the specifiedLongvalue.Create aNullablerepresentation of the specifiedShortvalue.static <T> Nullable<T> of(T value) Create aNullablerepresentation of the specified reference value.
-
Method Details
-
of
Create aNullablerepresentation of the specified reference value.- Type Parameters:
T- the type of wrapped reference value- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedintvalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedIntegervalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedlongvalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedLongvalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedshortvalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedShortvalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedbytevalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedBytevalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifieddoublevalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedDoublevalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedfloatvalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedFloatvalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedbooleanvalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
of
Create aNullablerepresentation of the specifiedBooleanvalue.- Parameters:
value- the value to create aNullablefor- Returns:
- a
Nullablerepresentation of the specified value
-
empty
Create an emptyNullablevalue.- Returns:
- an empty
Nullable
-
get
Return the value of the specifiedNullable.- Type Parameters:
T- the type ofNullablevalue- Parameters:
value- theNullablevalue to get the value from- Returns:
- the value of the specified
Nullable, ornullif theNullableis empty
-
get
Return the raw value of thisNullable.- Returns:
- the raw value of this
Nullable
-