L - the left element type.M - the middle element type.R - the right element type.public 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)
Constructs a new triple instance.
|
| Modifier and Type | Method and Description |
|---|---|
static <L,M,R> ImmutableTriple<L,M,R>[] |
emptyArray()
Gets 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()
Gets the immutable triple of nulls singleton.
|
static <L,M,R> ImmutableTriple<L,M,R> |
of(L left,
M middle,
R right)
Creates 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)
Creates 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 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 type.M - the middle element type.R - the right element type.public 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 type.M - the middle element type.R - the right element type.left - the left element, may be null.middle - the middle element, may be null.right - the right element, may be null.public 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 type.M - the middle element type.R - the right element type.left - the left element, may not be null.middle - the middle element, may not be null.right - the right element, may not be null.NullPointerException - if any input is null.public L getLeft()
public M getMiddle()
Copyright © 2001–2025 The Apache Software Foundation. All rights reserved.