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 Pair
s are considered equal if and only if
both the names and values are equal.
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.