info.fingo.util
Class Pair

java.lang.Object
  extended by info.fingo.util.Pair
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator

public class Pair
extends java.lang.Object
implements java.util.Comparator, java.io.Serializable

The simple string key - string value pair object.

Author:
carolus
See Also:
Serialized Form

Constructor Summary
Pair()
          Creates new instance with empty key and value.
Pair(java.lang.String key, java.lang.String value)
          Creates new instance with the given key and value.
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compares the values of the given pairs.
 java.lang.String getKey()
          Returns the key.
 java.lang.String getValue()
          Returns the value.
 void setKey(java.lang.String key)
          Sets the key.
 void setValue(java.lang.String value)
          Sets the value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

Pair

public Pair(java.lang.String key,
            java.lang.String value)
Creates new instance with the given key and value.

Parameters:
key - the key
value - the value

Pair

public Pair()
Creates new instance with empty key and value.

Method Detail

getKey

public java.lang.String getKey()
Returns the key.

Returns:
String

getValue

public java.lang.String getValue()
Returns the value.

Returns:
String

setKey

public void setKey(java.lang.String key)
Sets the key.

Parameters:
key - The key to set

setValue

public void setValue(java.lang.String value)
Sets the value.

Parameters:
value - The value to set

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compares the values of the given pairs.

Specified by:
compare in interface java.util.Comparator
Parameters:
o1 - the fist comparison argument
o2 - the second comparison argument
Returns:
The comparison result

toString

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