public class Pair<K,V>
extends java.lang.Object
A convenience class to represent name-value pairs.
| Constructor and Description |
|---|
Pair(K key,
V value)
Creates a new pair
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o)
Test this
Pair for equality with another
Object. |
K |
getKey()
Gets the key for this pair.
|
V |
getValue()
Gets the value for this pair.
|
int |
hashCode()
Generate a hash code for this
Pair. |
java.lang.String |
toString()
String representation of this
Pair. |
public K getKey()
public V getValue()
public java.lang.String toString()
String representation of this
Pair.
The default name/value delimiter '=' is always used.
toString in class java.lang.ObjectString representation of this Pairpublic int hashCode()
Generate a hash code for this Pair.
The hash code is calculated using both the name and
the value of the Pair.
hashCode in class java.lang.ObjectPairpublic boolean equals(java.lang.Object o)
Test this Pair for equality with another
Object.
If the Object to be tested is not a
Pair or is null, then this method
returns false.
Two Pairs are considered equal if and only if
both the names and values are equal.
equals in class java.lang.Objecto - the Object to test for
equality with this Pairtrue if the given Object is
equal to this Pair else falseCopyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.