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#

Type 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(L left, M middle, R right)

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

static final MutableTriple<?, ?, ?>[]

EMPTY_ARRAY

The empty array singleton.

L

left

Left object.

M

middle

Middle object.

R

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

static <L, M, R> MutableTriple<L, M, R>[]

emptyArray()

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

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

public L getLeft()[source]

Gets the left element from this triple.

Specified by:

getLeft in class Triple

Returns:

The left element, may be null.

public M getMiddle()[source]

Gets the middle element from this triple.

Specified by:

getMiddle in class Triple

Returns:

The middle element, may be null.

public R getRight()[source]

Gets the right element from this triple.

Specified by:

getRight in class 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:

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.