org.apache.commons.math3.util

## Class Pair<K,V>

- java.lang.Object
- - org.apache.commons.math3.util.Pair<K,V>

- Type Parameters:
    `K` - Key type.
    `V` - Value type.
  Direct Known Subclasses:
    PointValuePair, PointVectorValuePair

      public class Pair<K,V>
      extends Object

  Generic pair. Immutable class.
  Since:
    3.0
  Version:
    $Id$

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Pair(K k, V v)` Create an entry representing a mapping from the specified key to the specified value.
    `Pair(Pair<? extends K,? extends V> entry)` Create an entry representing the same mapping as the specified entry.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)` Compare the specified object with this entry for equality.
    `K` | `getKey()` Get the key.
    `V` | `getValue()` Get the value.
    `int` | `hashCode()` Compute a hash code.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Pair

          public Pair(K k,
              V v)

      Create an entry representing a mapping from the specified key to the specified value.
      Parameters:
        `k` - Key.
        `v` - Value.

    - #### Pair

          public Pair(Pair<? extends K,? extends V> entry)

      Create an entry representing the same mapping as the specified entry.
      Parameters:
        `entry` - Entry to copy.

  - ### Method Detail

    - #### getKey

          public K getKey()

      Get the key.
      Returns:
        the key.

    - #### getValue

          public V getValue()

      Get the value.
      Returns:
        the value.

    - #### equals

          public boolean equals(Object o)

      Compare the specified object with this entry for equality.
      Overrides:
        `equals` in class `Object`
      Parameters:
        `o` - Object.
      Returns:
        `true` if the given object is also a map entry and the two entries represent the same mapping.

    - #### hashCode

          public int hashCode()

      Compute a hash code.
      Overrides:
        `hashCode` in class `Object`
      Returns:
        the hash code value.

Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.