com.cliftonsnyder.util
Class Pair<K extends java.lang.Comparable,V>

java.lang.Object
  extended by com.cliftonsnyder.util.Pair<K,V>
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

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

A simple generic class for handling key-value pairs

Author:
Clifton L. Snyder
See Also:
Serialized Form

Constructor Summary
Pair()
          an empty, parameterless constructor; this is necessary if this class is going to "play nice" with ProActive
Pair(K key, V value)
          Creates a key-value pair
 
Method Summary
 int compareTo(java.lang.Object o)
           
 K getKey()
           
 V getValue()
           
 void setKey(K key)
           
 void setValue(V value)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair()
an empty, parameterless constructor; this is necessary if this class is going to "play nice" with ProActive


Pair

public Pair(K key,
            V value)
Creates a key-value pair

Parameters:
key - the pair's key
value - the pair's value
Method Detail

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

getKey

public K getKey()
Returns:
the key-value pair's key

getValue

public V getValue()
Returns:
the key-value pair's value

setKey

public void setKey(K key)
Parameters:
key - the new key for the key-value pair

setValue

public void setValue(V value)
Parameters:
value - the key-value pair's new value

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object