ImmutableTriple¶
- public class org.apache.commons.lang3.tuple.ImmutableTriple<L, M, R> extends Triple<L, M, R>[source]¶
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.
#ThreadSafe# if all three objects are thread-safe.
- Parameters:
<L> – The left element type.
<M> – The middle element type.
<R> – The right element type.
- Since:
3.2
Constructors¶
Constructs a new triple instance. |
Fields and constants¶
An empty array. |
|
Left object. |
|
Middle object. |
|
Right object. |
- public static final ImmutableTriple<?, ?, ?>[] EMPTY_ARRAY[source]¶
An empty array.
Consider using
#emptyArray()to avoid generics warnings.- Since:
3.10
Methods¶
Gets the empty array singleton that can be assigned without compiler warning. |
|
Gets the left element from this triple. |
|
Gets the middle element from this triple. |
|
Gets the right element from this triple. |
|
Gets the immutable triple of nulls singleton. |
|
Creates an immutable triple of three objects inferring the generic types. |
|
Creates an immutable triple of three non-null objects inferring the generic types. |
- @SuppressWarnings({"unchecked"}) public static <L, M, R> ImmutableTriple<L, M, R>[] emptyArray()[source]¶
Gets the empty array singleton that can be assigned without compiler warning.
- Type parameters:
<L> – The left element type.
<M> – The middle element type.
<R> – The right element type.
- Returns:
The empty array singleton that can be assigned without compiler warning.
- Since:
3.10
- @Override public L getLeft()[source]¶
Gets the left element from this triple.
- Returns:
The left element, may be null.
- @Override public M getMiddle()[source]¶
Gets the middle element from this triple.
- Returns:
The middle element, may be null.
- @Override public R getRight()[source]¶
Gets the right element from this triple.
- Returns:
The right element, may be null.
- @SuppressWarnings({"unchecked"}) public static <L, M, R> ImmutableTriple<L, M, R> nullTriple()[source]¶
Gets the immutable triple of nulls singleton.
- Type parameters:
<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.
- Returns:
An immutable triple of nulls.
- Since:
3.6
- public static <L, M, R> ImmutableTriple<L, M, R> of(L left, M middle, R right)[source]¶
Creates an immutable triple of three objects inferring the generic types.
- Type parameters:
<L> – The left element type.
<M> – The middle element type.
<R> – The right element type.
- Parameters:
left – The left element, may be null.
middle – The middle element, may be null.
right – The right element, may be null.
- Returns:
An immutable triple formed from the three parameters, not null.
- public static <L, M, R> ImmutableTriple<L, M, R> ofNonNull(L left, M middle, R right)[source]¶
Creates an immutable triple of three non-null objects inferring the generic types.
- Type parameters:
<L> – The left element type.
<M> – The middle element type.
<R> – The right element type.
- Parameters:
left – The left element, may not be null.
middle – The middle element, may not be null.
right – The right element, may not be null.
- Returns:
An immutable triple formed from the three parameters, not null.
- Throws:
java.lang.NullPointerException – Thrown if any input is null.
- Since:
3.13.0