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 behavior.
#ThreadSafe# if all three objects are thread-safe
Modifier and Type | Field and Description |
---|---|
static ImmutableTriple<?,?,?>[] |
EMPTY_ARRAY
An empty array.
|
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 |
---|---|
static <L,M,R> ImmutableTriple<L,M,R>[] |
emptyArray()
Returns the empty array singleton that can be assigned without compiler warning.
|
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 static final ImmutableTriple<?,?,?>[] EMPTY_ARRAY
Consider using emptyArray()
to avoid generics warnings.
public final L left
public final M middle
public final R right
public static <L,M,R> ImmutableTriple<L,M,R>[] emptyArray()
L
- the left element typeM
- the middle element typeR
- the right element typepublic 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 nullpublic L getLeft()
Gets the left element from this triple.
public M getMiddle()
Gets the middle element from this triple.
Copyright © 2001–2021 The Apache Software Foundation. All rights reserved.