Class OrderedPair

java.lang.Object
  extended byOrderedPair
All Implemented Interfaces:
java.util.Map.Entry

public class OrderedPair
extends java.lang.Object
implements java.util.Map.Entry

An OrderedPair is a key/value pair. It implements the Map.Entry interface and is returned by AssociationList.entrySet().


Field Summary
(package private)  java.lang.Object key
          The key of this OrderedPair.
(package private)  java.lang.Object value
          The value of this OrderedPair.
 
Constructor Summary
OrderedPair(java.lang.Object key, java.lang.Object value)
          Returns a new OrderedPair with the given key and value.
 
Method Summary
 boolean equals(java.lang.Object o)
          Tests the given Object for equality with this OrderedPair.
 java.lang.Object getKey()
          Returns the key of this OrderedPair.
 java.lang.Object getValue()
          Returns the value of this OrderedPair.
 int hashCode()
          Returns the hashCode of this OrderedPair.
 java.lang.Object setValue(java.lang.Object value)
          Sets the value of this OrdredPair.
 java.lang.String toString()
          Returns the String representation of this OrderedPair.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

key

java.lang.Object key
The key of this OrderedPair.


value

java.lang.Object value
The value of this OrderedPair.

Constructor Detail

OrderedPair

public OrderedPair(java.lang.Object key,
                   java.lang.Object value)
Returns a new OrderedPair with the given key and value.

Method Detail

equals

public boolean equals(java.lang.Object o)
Tests the given Object for equality with this OrderedPair. Per the Map.Entry interface convention, teh following must hold for this method to return true: (1) the given Object must itself be an OrderedPair, (2) both keys must either be null or equals() must be true of them, and (3) both values must either be null or equals() must be true of them.

Specified by:
equals in interface java.util.Map.Entry

getKey

public java.lang.Object getKey()
Returns the key of this OrderedPair.

Specified by:
getKey in interface java.util.Map.Entry

getValue

public java.lang.Object getValue()
Returns the value of this OrderedPair.

Specified by:
getValue in interface java.util.Map.Entry

hashCode

public int hashCode()
Returns the hashCode of this OrderedPair. Per the Map.Entry interface convention, this is computed as the logical XOR (``^'') of the key and value hashCodes (using 0 for null key or value).

Specified by:
hashCode in interface java.util.Map.Entry

setValue

public java.lang.Object setValue(java.lang.Object value)
Sets the value of this OrdredPair. Per the Map.Entry interface, this method returns the previous value.

Specified by:
setValue in interface java.util.Map.Entry

toString

public java.lang.String toString()
Returns the String representation of this OrderedPair.