ImmutableTriple

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

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.

Type parameters:
  • <L> – The left element type.

  • <M> – The middle element type.

  • <R> – The right element type.

Since:

3.2

Constructors

ImmutableTriple(L left, M middle, R right)

Constructs a new triple instance.

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

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.

Fields and constants

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

EMPTY_ARRAY

An empty array.

final L

left

Left object.

final M

middle

Middle object.

final R

right

Right object.

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

An empty array.

Consider using emptyArray() to avoid generics warnings.

Since:

3.10

public final L left[source]

Left object.

public final M middle[source]

Middle object.

public final R right[source]

Right object.

Methods

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.

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

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> 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:

NullPointerException – Thrown if any input is null.

Since:

3.13.0