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.

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

  • <M> – The middle element type.

  • <R> – The right element type.

Since:

3.2

Constructors

ImmutableTriple(Object, Object, Object)

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

EMPTY_ARRAY

An empty array.

left

Left object.

middle

Middle object.

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

emptyArray()

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

nullTriple()

Gets the immutable triple of nulls singleton.

of(Object, Object, Object)

Creates an immutable triple of three objects inferring the generic types.

ofNonNull(Object, Object, Object)

Creates an immutable triple of three non-null objects inferring the generic types.

@SuppressWarnings({"unchecked"}) 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

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

@SuppressWarnings({"unchecked"}) 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:

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

Since:

3.13.0