IntIntPair
value public final class IntIntPair
Container to ease passing around a tuple of two Int values.
Note: This class is optimized by using a value class, a Kotlin language featured not available from Java code. Java developers can get the same functionality by using Pair or by constructing a custom implementation using Int parameters directly (see LongLongPair for an example).
Summary
Public fields |
|
|---|---|
final long |
The internal representation of the |
Public constructors |
|---|
IntIntPair(int first, int second)Constructs a |
Public methods |
|
|---|---|
final int |
Returns the |
final int |
Returns the |
final int |
getFirst()The first value in the pair. |
final int |
The second value in the pair. |
@NonNull String |
toString() |
Public fields
packedValue
public final long packedValue
The internal representation of the IntIntPair. packedValue has no guarantees for stability across library versions.
Public constructors
IntIntPair
public IntIntPair(int first, int second)
Constructs a IntIntPair with two Int values.
| Parameters | |
|---|---|
int first |
the first value in the pair |
int second |
the second value in the pair |
Public methods
component1
public final int component1()
Returns the first component of the pair. For instance, the first component of PairIntInt(3, 4) is 3.
This method allows to use destructuring declarations when working with pairs, for example:
val (first, second) = myPair
component2
public final int component2()
Returns the second component of the pair. For instance, the second component of PairIntInt(3, 4) is 4.
This method allows to use destructuring declarations when working with pairs, for example:
val (first, second) = myPair