com.alee.utils.general
Class Pair<K,V>

java.lang.Object
  extended by com.alee.utils.general.Pair<K,V>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Pair<K,V>
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This class represents single name-value pair.

Author:
Mikle Garin
See Also:
Serialized Form

Field Summary
 K key
          Key of this Pair.
 V value
          Value of this this Pair.
 
Constructor Summary
Pair()
          Constructs a new pair with null key and value.
Pair(K key)
          Constructs a new pair with null value.
Pair(K key, V value)
          Constructs a new pair
 
Method Summary
 Pair<K,V> clone()
          
 boolean equals(java.lang.Object o)
          
 K getKey()
          Gets the key for this pair.
 V getValue()
          Gets the value for this pair.
 int hashCode()
          
 void setKey(K key)
          Sets the key for this pair.
 void setValue(V value)
          Sets the value for this pair.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

key

@XStreamAsAttribute
public K key
Key of this Pair.


value

@XStreamAsAttribute
public V value
Value of this this Pair.

Constructor Detail

Pair

public Pair()
Constructs a new pair with null key and value.


Pair

public Pair(K key)
Constructs a new pair with null value.

Parameters:
key - The key for this pair

Pair

public Pair(K key,
            V value)
Constructs a new pair

Parameters:
key - The key for this pair
value - The value to use for this pair
Method Detail

getKey

public K getKey()
Gets the key for this pair.

Returns:
key for this pair

setKey

public void setKey(K key)
Sets the key for this pair.

Parameters:
key - new key for this pair

getValue

public V getValue()
Gets the value for this pair.

Returns:
value for this pair

setValue

public void setValue(V value)
Sets the value for this pair.

Parameters:
value - new value for this pair

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object

clone

public Pair<K,V> clone()

Overrides:
clone in class java.lang.Object