Class MutableTriple<L,M,R>

java.lang.Object
org.apache.commons.lang3.tuple.Triple<L,M,R>
org.apache.commons.lang3.tuple.MutableTriple<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 MutableTriple<L,M,R> extends Triple<L,M,R>
A mutable triple consisting of three Object elements.

Not #ThreadSafe#

Since:
3.2
See Also:
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    static final MutableTriple<?,?,?>[]
    The empty array singleton.
    Left object.
    Middle object.
    Right object.
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Create a new triple instance of three nulls.
    MutableTriple(L left, M middle, R right)
    Create a new triple instance.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    static <L, M, R> MutableTriple<L,M,R>[]
    Returns 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.
    static <L, M, R> MutableTriple<L,M,R>
    of(L left, M middle, R right)
    Obtains a mutable triple of three objects inferring the generic types.
    static <L, M, R> MutableTriple<L,M,R>
    ofNonNull(L left, M middle, R right)
    Obtains a mutable triple of three non-null objects inferring the generic types.
    void
    setLeft(L left)
    Sets the left element of the triple.
    void
    setMiddle(M middle)
    Sets the middle element of the triple.
    void
    setRight(R right)
    Sets the right element of the triple.

    Methods inherited from class org.apache.commons.lang3.tuple.Triple Link icon

    compareTo, equals, hashCode, toString, toString

    Methods inherited from class java.lang.Object Link icon

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details Link icon

    • EMPTY_ARRAY Link icon

      public static final MutableTriple<?,?,?>[] EMPTY_ARRAY
      The empty array singleton.

      Consider using emptyArray() to avoid generics warnings.

      Since:
      3.10
    • left Link icon

      public L left
      Left object.
    • middle Link icon

      public M middle
      Middle object.
  • Constructor Details Link icon

    • MutableTriple Link icon

      public MutableTriple()
      Create a new triple instance of three nulls.
    • MutableTriple Link icon

      public MutableTriple(L left, M middle, R right)
      Create 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 Link icon

    • emptyArray Link icon

      public static <L, M, R> MutableTriple<L,M,R>[] emptyArray()
      Returns 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
    • of Link icon

      public static <L, M, R> MutableTriple<L,M,R> of(L left, M middle, R right)
      Obtains a mutable 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 Link icon

      public static <L, M, R> MutableTriple<L,M,R> ofNonNull(L left, M middle, R right)
      Obtains a mutable 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 Link icon

      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 Link icon

      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 Link icon

      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.
    • setLeft Link icon

      public void setLeft(L left)
      Sets the left element of the triple.
      Parameters:
      left - the new value of the left element, may be null.
    • setMiddle Link icon

      public void setMiddle(M middle)
      Sets the middle element of the triple.
      Parameters:
      middle - the new value of the middle element, may be null.
    • setRight Link icon

      public void setRight(R right)
      Sets the right element of the triple.
      Parameters:
      right - the new value of the right element, may be null.