On this page

MutableTriple

public class org.apache.commons.lang3.tuple.MutableTriple<L, M, R> extends Triple<L, M, R>[source]

A mutable triple consisting of three Object elements.

Not #ThreadSafe#

Parameters:
  • <L> – The left element type.

  • <M> – The middle element type.

  • <R> – The right element type.

Since:

3.2

Constructors

MutableTriple()

Create a new triple instance of three nulls.

MutableTriple(Object, Object, Object)

Create a new triple instance.

public MutableTriple()[source]

Create a new triple instance of three nulls.

public MutableTriple(L left, M middle, R right)[source]

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.

Fields and constants

EMPTY_ARRAY

The empty array singleton.

left

Left object.

middle

Middle object.

right

Right object.

public static final MutableTriple<?, ?, ?>[] EMPTY_ARRAY[source]

The empty array singleton.

Consider using #emptyArray() to avoid generics warnings.

Since:

3.10

public L left[source]

Left object.

public M middle[source]

Middle object.

public R right[source]

Right object.

Methods

emptyArray()

Returns the empty array singleton that can be assigned without compiler warning.

getLeft()

Gets the left element from this triple.

getMiddle()

Gets the middle element from this triple.

getRight()

Gets the right element from this triple.

of(Object, Object, Object)

Obtains a mutable triple of three objects inferring the generic types.

ofNonNull(Object, Object, Object)

Obtains a mutable triple of three non-null objects inferring the generic types.

setLeft(Object)

Sets the left element of the triple.

setMiddle(Object)

Sets the middle element of the triple.

setRight(Object)

Sets the right element of the triple.

@SuppressWarnings({"unchecked"}) public static <L, M, R> MutableTriple<L, M, R>[] emptyArray()[source]

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

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

public static <L, M, R> MutableTriple<L, M, R> of(L left, M middle, R right)[source]

Obtains a mutable 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:

A mutable triple formed from the three parameters, not null.

public static <L, M, R> MutableTriple<L, M, R> ofNonNull(L left, M middle, R right)[source]

Obtains a mutable 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:

A mutable triple formed from the three parameters, not null.

Throws:

java.lang.NullPointerException – Thrown if any input is null.

Since:

3.13.0

public void setLeft(L left)[source]

Sets the left element of the triple.

Parameters:

left – The new value of the left element, may be null.

public void setMiddle(M middle)[source]

Sets the middle element of the triple.

Parameters:

middle – The new value of the middle element, may be null.

public void setRight(R right)[source]

Sets the right element of the triple.

Parameters:

right – The new value of the right element, may be null.