Class ImmutableTriple<L,M,R>
java.lang.Object
org.daiitech.naftah.builtin.utils.tuple.Triple<L,M,R>
org.daiitech.naftah.builtin.utils.tuple.ImmutableTriple<L,M,R>
- Type Parameters:
L- the left element typeM- the middle element typeR- the right element type
- All Implemented Interfaces:
Serializable,Comparable<Triple<L,,M, R>> NTuple
An immutable triple consisting of three
Object elements.
Although the implementation is immutable, there is no restriction on the objects that may be stored. If mutable objects are stored in the triple, then the triple itself effectively becomes mutable.
#ThreadSafe# if all three objects are thread-safe
- Author:
- Chakib Daii
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal LLeft object.final MMiddle object.private static final ImmutableTripleAn immutable triple of nulls.final RRight object.private static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetLeft()Gets the left element from this triple.Gets the middle element from this triple.getRight()Gets the right element from this triple.static <L,M, R> ImmutableTriple<L, M, R> Returns an immutable triple of nulls.static <L,M, R> ImmutableTriple<L, M, R> of(L left, M middle, R right) Obtains an immutable triple of three objects inferring the generic types.static <L,M, R> ImmutableTriple<L, M, R> ofNonNull(L left, M middle, R right) Obtains an immutable triple of three non-null objects inferring the generic types.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
NULL
An immutable triple of nulls. -
left
Left object. -
middle
Middle object. -
right
Right object.
-
-
Constructor Details
-
ImmutableTriple
Create a new triple instance.- Parameters:
left- the left value, may be nullmiddle- the middle value, may be nullright- the right value, may be null
-
-
Method Details
-
nullTriple
Returns an immutable triple of nulls.- Type Parameters:
L- the left element of this triple. Value isnull.M- the middle element of this triple. Value isnull.R- the right element of this triple. Value isnull.- Returns:
- an immutable triple of nulls.
-
of
Obtains an immutable triple of three objects inferring the generic types.This factory allows the triple to be created using inference to obtain the generic types.
- Type Parameters:
L- the left element typeM- the middle element typeR- the right element type- Parameters:
left- the left element, may be nullmiddle- the middle element, may be nullright- the right element, may be null- Returns:
- a triple formed from the three parameters, not null
-
ofNonNull
Obtains an immutable triple of three non-null objects inferring the generic types.This factory allows the triple to be created using inference to obtain the generic types.
- Type Parameters:
L- the left element typeM- the middle element typeR- the right element type- Parameters:
left- the left element, may not be nullmiddle- the middle element, may not be nullright- the right element, may not be null- Returns:
- a triple formed from the three parameters, not null
- Throws:
NullPointerException- if any input is null
-
getLeft
Gets the left element from this triple. -
getMiddle
Gets the middle element from this triple. -
getRight
Gets the right element from this triple.
-