Package org.apache.commons.lang3.tuple

# Class ImmutableTriple<L,M,R>

java.lang.Object
org.apache.commons.lang3.tuple.Triple<L,M,R>
org.apache.commons.lang3.tuple.ImmutableTriple<L,M,R>

Type Parameters:
  `L` - the left element type.
  `M` - the middle element type.
  `R` - the right element type.

All Implemented Interfaces:
  `Serializable`, `Comparable<Triple<L,M,R>>`

public 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.

#ThreadSafe# if all three objects are thread-safe.

Since:
  3.2
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final ImmutableTriple<?,?,?>[]`
  `EMPTY_ARRAY`
  An empty array.
  `final L`
  `left`
  Left object.
  `final M`
  `middle`
  Middle object.
  `final R`
  `right`
  Right object.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ImmutableTriple(L left, M middle, R right)`
  Constructs a new triple instance.

- ## Method Summary

  Modifier and Type
  Method
  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.

  ### Methods inherited from class org.apache.commons.lang3.tuple.Triple

  `compareTo, equals, hashCode, toString, toString`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### EMPTY_ARRAY

    public static final ImmutableTriple<?,?,?>[] EMPTY_ARRAY
    An empty array.

    Consider using `emptyArray()` to avoid generics warnings.

    Since:
      3.10

  - ### left

    public final L left
    Left object.

  - ### middle

    public final M middle
    Middle object.

  - ### right

    public final R right
    Right object.

- ## Constructor Details

  - ### ImmutableTriple

    public ImmutableTriple(L left, M middle, R right)
    Constructs a new triple instance.
    Parameters:
      `left` - the left value, may be null.
      `middle` - the middle value, may be null.
      `right` - the right value, may be null.

- ## Method Details

  - ### emptyArray

    public static <L, M, R> ImmutableTriple<L,M,R>[] emptyArray()
    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

  - ### nullTriple

    public static <L, M, R> ImmutableTriple<L,M,R> nullTriple()
    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

  - ### of

    public 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.

    This factory allows the triple to be created using inference to obtain 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:
      a triple formed from the three parameters, not null.

  - ### ofNonNull

    public 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.

    This factory allows the triple to be created using inference to obtain 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:
      a triple formed from the three parameters, not null.
    Throws:
      `NullPointerException` - if any input is null.
    Since:
      3.13.0

  - ### getLeft

    public L getLeft()
    Gets the left element from this triple.
    Specified by:
      `getLeft` in class `Triple<L,M,R>`
    Returns:
      the left element, may be null.

  - ### getMiddle

    public M getMiddle()
    Gets the middle element from this triple.
    Specified by:
      `getMiddle` in class `Triple<L,M,R>`
    Returns:
      the middle element, may be null.

  - ### getRight

    public R getRight()
    Gets the right element from this triple.
    Specified by:
      `getRight` in class `Triple<L,M,R>`
    Returns:
      the right element, may be null.