@Generated(value="org.immutables.processor.ProxyProcessor") public final class ImmutablePair<FIRST,SECOND> extends Pair<FIRST,SECOND>
Pair.
Use the builder to create immutable instances:
ImmutablePair.builder().
Use the static factory method to create immutable instances:
ImmutablePair.of().
| Modifier and Type | Class and Description |
|---|---|
static class |
ImmutablePair.Builder<FIRST,SECOND>
Builds instances of type
ImmutablePair. |
Pair.PairTypeInfo<FIRST,SECOND>| Modifier and Type | Method and Description |
|---|---|
static <FIRST,SECOND> |
builder()
Creates a builder for
ImmutablePair. |
static <FIRST,SECOND> |
copyOf(Pair<FIRST,SECOND> instance)
Creates an immutable copy of a
Pair value. |
boolean |
equals(Object another)
This instance is equal to all instances of
ImmutablePair that have equal attribute values. |
FIRST |
first() |
int |
hashCode()
Computes a hash code from attributes:
first, second. |
static <FIRST,SECOND> |
of(FIRST first,
SECOND second)
Construct a new immutable
Pair instance. |
SECOND |
second() |
String |
toString()
Prints the immutable value
Pair with attribute values. |
ImmutablePair<FIRST,SECOND> |
withFirst(FIRST value)
Copy the current immutable object by setting a value for the
first attribute. |
ImmutablePair<FIRST,SECOND> |
withSecond(SECOND value)
Copy the current immutable object by setting a value for the
second attribute. |
public FIRST first()
public SECOND second()
public final ImmutablePair<FIRST,SECOND> withFirst(FIRST value)
first attribute.
A shallow reference equality check is used to prevent copying of the same value by returning this.value - A new value for firstthis objectpublic final ImmutablePair<FIRST,SECOND> withSecond(SECOND value)
second attribute.
A shallow reference equality check is used to prevent copying of the same value by returning this.value - A new value for secondthis objectpublic boolean equals(Object another)
ImmutablePair that have equal attribute values.public int hashCode()
first, second.public String toString()
Pair with attribute values.public static <FIRST,SECOND> ImmutablePair<FIRST,SECOND> of(FIRST first, SECOND second)
Pair instance.FIRST - generic parameter FIRSTSECOND - generic parameter SECONDfirst - The value for the first attributesecond - The value for the second attributepublic static <FIRST,SECOND> ImmutablePair<FIRST,SECOND> copyOf(Pair<FIRST,SECOND> instance)
Pair value.
Uses accessors to get values to initialize the new immutable instance.
If an instance is already immutable, it is returned as is.FIRST - generic parameter FIRSTSECOND - generic parameter SECONDinstance - The instance to copypublic static <FIRST,SECOND> ImmutablePair.Builder<FIRST,SECOND> builder()
ImmutablePair.
ImmutablePair.<FIRST, SECOND>builder()
.first(FIRST) // required first
.second(SECOND) // required second
.build();
FIRST - generic parameter FIRSTSECOND - generic parameter SECONDCopyright © 2025. All rights reserved.