# IntIntPair

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/IntIntPair.kt+class:androidx.collection.IntIntPair) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

*** ** * ** ***

<br />

```
value public final class IntIntPair
```

<br />

*** ** * ** ***

Container to ease passing around a tuple of two `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` 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 `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html` or by constructing a custom implementation using Int parameters directly (see `https://developer.android.com/reference/androidx/collection/LongLongPair` for an example).

## Summary

| ### Public fields |
|---|---|
| `final long` | `https://developer.android.com/reference/androidx/collection/IntIntPair#packedValue()` The internal representation of the `https://developer.android.com/reference/androidx/collection/IntIntPair`. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/collection/IntIntPair#IntIntPair(kotlin.Int,kotlin.Int)(int first, int second)` Constructs a `https://developer.android.com/reference/androidx/collection/IntIntPair` with two `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` values. |

| ### Public methods |
|---|---|
| `final int` | `https://developer.android.com/reference/androidx/collection/IntIntPair#component1()()` Returns the `https://developer.android.com/reference/androidx/collection/IntIntPair#first()` component of the pair. |
| `final int` | `https://developer.android.com/reference/androidx/collection/IntIntPair#component2()()` Returns the `https://developer.android.com/reference/androidx/collection/IntIntPair#second()` component of the pair. |
| `final int` | `https://developer.android.com/reference/androidx/collection/IntIntPair#getFirst()()` The first value in the pair. |
| `final int` | `https://developer.android.com/reference/androidx/collection/IntIntPair#getSecond()()` The second value in the pair. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/collection/IntIntPair#toString()()` |

## Public fields

### packedValue

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
public final long packedValue
```

The internal representation of the `https://developer.android.com/reference/androidx/collection/IntIntPair`. `https://developer.android.com/reference/androidx/collection/IntIntPair#(kotlin.Long)` has no guarantees for stability across library versions.

## Public constructors

### IntIntPair

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public IntIntPair(int first, int second)
```

Constructs a `https://developer.android.com/reference/androidx/collection/IntIntPair` with two `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` values.

| Parameters |
|---|---|
| `int first` | the first value in the pair |
| `int second` | the second value in the pair |

## Public methods

### component1

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final int component1()
```

Returns the `https://developer.android.com/reference/androidx/collection/IntIntPair#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

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final int component2()
```

Returns the `https://developer.android.com/reference/androidx/collection/IntIntPair#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
```

### getFirst

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final int getFirst()
```

The first value in the pair.

### getSecond

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final int getSecond()
```

The second value in the pair.

### toString

```
public @NonNull String toString()
```