Class MutableTriple<L,M,R>
java.lang.Object
org.daiitech.naftah.builtin.utils.tuple.Triple<L,M,R>
org.daiitech.naftah.builtin.utils.tuple.MutableTriple<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
A mutable triple consisting of three
Object elements.
Not #ThreadSafe#
- Author:
- Chakib Daii
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new triple instance of three nulls.MutableTriple(L left, M middle, R right) Create a new triple instance. -
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> MutableTriple<L, M, R> of(L left, M middle, R right) Obtains a mutable triple of three objects inferring the generic types.static <L,M, R> MutableTriple<L, M, R> ofNonNull(L left, M middle, R right) Obtains a mutable triple of three non-null objects inferring the generic types.voidSets the left element of the triple.voidSets the middle element of the triple.voidSets the right element of the triple.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
left
Left object. -
middle
Middle object. -
right
Right object.
-
-
Constructor Details
-
MutableTriple
public MutableTriple()Create a new triple instance of three nulls. -
MutableTriple
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
-
of
Obtains a mutable 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 a mutable 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. -
setLeft
Sets the left element of the triple.- Parameters:
left- the new value of the left element, may be null
-
getMiddle
Gets the middle element from this triple. -
setMiddle
Sets the middle element of the triple.- Parameters:
middle- the new value of the middle element, may be null
-
getRight
Gets the right element from this triple. -
setRight
Sets the right element of the triple.- Parameters:
right- the new value of the right element, may be null
-