Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Fields](https://developer.android.com/reference/android/util/Pair#lfields) \| [Ctors](https://developer.android.com/reference/android/util/Pair#pubctors) \| [Methods](https://developer.android.com/reference/android/util/Pair#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/util/Pair#inhmethods)

# Pair

*** ** * ** ***

` public class Pair `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.util.Pair\<F, S\> |

<br />

*** ** * ** ***

Container to ease passing around a tuple of two objects. This object provides a sensible implementation of equals(), returning true if equals() is true on each of the contained objects.

## Summary

| ### Fields ||
|---|---|
| ` public final F` | `https://developer.android.com/reference/android/util/Pair#first` <br /> |
| ` public final S` | `https://developer.android.com/reference/android/util/Pair#second` <br /> |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/util/Pair#Pair(F,%20S)(F first, S second) ` Constructor for a Pair. |

| ### Public methods ||
|---|---|
| ` static <A, B> https://developer.android.com/reference/android/util/Pair<A, B>` | ` https://developer.android.com/reference/android/util/Pair#create(A,%20B)(A a, B b) ` Convenience method for creating an appropriately typed pair. |
| ` boolean` | ` https://developer.android.com/reference/android/util/Pair#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Checks the two objects for equality by delegating to their respective `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` methods. |
| ` int` | ` https://developer.android.com/reference/android/util/Pair#hashCode()() ` Compute a hash code using the hash codes of the underlying objects |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/util/Pair#toString()() ` Returns a string representation of the object. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Fields

### first

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public final F first
```

<br />

<br />

### second

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public final S second
```

<br />

<br />

## Public constructors

### Pair

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Pair (F first, 
                S second)
```

Constructor for a Pair.

<br />

| Parameters ||
|---|---|
| `first` | `F`: the first object in the Pair <br /> |
| `second` | `S`: the second object in the pair <br /> |

## Public methods

### create

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Pair<A, B> create (A a, 
                B b)
```

Convenience method for creating an appropriately typed pair.

<br />

| Parameters ||
|---|---|
| `a` | `A`: the first object in the Pair <br /> |
| `b` | `B`: the second object in the pair <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/util/Pair<A, B>` | a Pair that is templatized with the types of a and b <br /> |

### equals

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object o)
```

Checks the two objects for equality by delegating to their respective `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` methods.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: the `https://developer.android.com/reference/android/util/Pair` to which this one is to be checked for equality. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the underlying objects of the Pair are both considered equal <br /> |

### hashCode

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

Compute a hash code using the hash codes of the underlying objects

<br />

| Returns ||
|---|---|
| `int` | a hashcode of the Pair <br /> |

### toString

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |