L
- the left element typeM
- the middle element typeR
- the right element typepublic final class ImmutableTriple<L,M,R> extends Triple<L,M,R>
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. The class is also final
, so a subclass
can not add undesirable behaviour.
#ThreadSafe# if all three objects are thread-safe
Modifier and Type | Field and Description |
---|---|
L |
left
Left object
|
M |
middle
Middle object
|
R |
right
Right object
|
Constructor and Description |
---|
ImmutableTriple(L left,
M middle,
R right)
Create a new triple instance.
|
Modifier and Type | Method and Description |
---|---|
L |
getLeft()
Gets the left element from this triple.
|
M |
getMiddle()
Gets the middle element from this triple.
|
R |
getRight()
Gets the right element from this triple.
|
static <L,M,R> ImmutableTriple<L,M,R> |
nullTriple()
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.
|
public ImmutableTriple(L left, M middle, R right)
left
- the left value, may be nullmiddle
- the middle value, may be nullright
- the right value, may be nullpublic static <L,M,R> ImmutableTriple<L,M,R> nullTriple()
L
- the left element of this triple. Value is null
.M
- the middle element of this triple. Value is null
.R
- the right element of this triple. Value is null
.public 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.
This factory allows the triple to be created using inference to obtain the generic types.
L
- the left element typeM
- the middle element typeR
- the right element typeleft
- the left element, may be nullmiddle
- the middle element, may be nullright
- the right element, may be nullCopyright © 2001–2018 The Apache Software Foundation. All rights reserved.