L
- the left element typeM
- the middle element typeR
- the right element typepublic class ImmutableTriple<L,M,R> extends Triple<L,M,R>
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
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.
|
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.
|
public static final ImmutableTriple<?,?,?>[] EMPTY_ARRAY
Consider using emptyArray()
to avoid generics warnings.
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>[] 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)
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 static <L,M,R> ImmutableTriple<L,M,R> ofNonNull(L left, M middle, R right)
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 not be nullmiddle
- the middle element, may not be nullright
- the right element, may not be nullNullPointerException
- if any input is nullCopyright © 2001–2023 The Apache Software Foundation. All rights reserved.