public class Pair<K,V> extends Object implements Serializable
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(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. |
String |
toString()
String representation of this
Pair. |
public K getKey()
public V getValue()
public String toString()
String representation of this
Pair.
The default name/value delimiter '=' is always used.
public int hashCode()
Generate a hash code for this Pair.
The hash code is calculated using both the name and
the value of the Pair.
public boolean equals(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.
Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.