org.apache.commons.lang3.tuple
Class ImmutableTriple<L,M,R>
- java.lang.Object
-
- org.apache.commons.lang3.tuple.Triple<L,M,R>
-
- org.apache.commons.lang3.tuple.ImmutableTriple<L,M,R>
-
- Type Parameters:
L- the left element typeM- the middle element typeR- the right element type
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<Triple<L,M,R>>
public final class ImmutableTriple<L,M,R> extends Triple<L,M,R>
An immutable triple consisting of three
Objectelements.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. The class is also not
final, so a subclass could add undesirable behaviour.#ThreadSafe# if all three objects are thread-safe
- Since:
- 3.2
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description LleftLeft objectMmiddleMiddle objectRrightRight object
-
Constructor Summary
Constructors Constructor and Description ImmutableTriple(L left, M middle, R right)Create a new triple instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description LgetLeft()Gets the left element from this triple.MgetMiddle()Gets the middle element from this triple.RgetRight()Gets the right element from this triple.static <L,M,R> ImmutableTriple<L,M,R>of(L left, M middle, R right)Obtains an immutable triple of from three objects inferring the generic types.
-
-
-
Field Detail
-
left
public final L left
Left object
-
middle
public final M middle
Middle object
-
right
public final R right
Right object
-
-
Method Detail
-
of
public static <L,M,R> ImmutableTriple<L,M,R> of(L left, M middle, R right)
Obtains an immutable triple of from 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
-
getLeft
public L getLeft()
Gets the left element from this triple.
-
getMiddle
public M getMiddle()
Gets the middle element from this triple.
-
-
DMelt 3.0 © DataMelt by jWork.ORG