- java.lang.Object
-
- javafx.util.Pair<K,V>
-
- All Implemented Interfaces:
Serializable
public class Pair<K,V> extends Object implements Serializable
A convenience class to represent name-value pairs.
- Since:
- JavaFX 2.0
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Test thisPair
for equality with anotherObject
.K
getKey()
Gets the key for this pair.V
getValue()
Gets the value for this pair.int
hashCode()
Generate a hash code for thisPair
.String
toString()
String
representation of thisPair
.
-
-
-
Method Detail
-
getKey
public K getKey()
Gets the key for this pair.- Returns:
- key for this pair
-
getValue
public V getValue()
Gets the value for this pair.- Returns:
- value for this pair
-
toString
public String toString()
String
representation of thisPair
.The default name/value delimiter '=' is always used.
-
hashCode
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
.- Overrides:
hashCode
in classObject
- Returns:
- hash code for this
Pair
- See Also:
Object.equals(java.lang.Object)
,System.identityHashCode(java.lang.Object)
-
equals
public boolean equals(Object o)
Test this
Pair
for equality with anotherObject
.If the
Object
to be tested is not aPair
or isnull
, then this method returnsfalse
.Two
Pair
s are considered equal if and only if both the names and values are equal.- Overrides:
equals
in classObject
- Parameters:
o
- theObject
to test for equality with thisPair
- Returns:
true
if the givenObject
is equal to thisPair
elsefalse
- See Also:
Object.hashCode()
,HashMap
-
-