gausssoft.collections
Class MapEntry

java.lang.Object
  |
  +--gausssoft.collections.MapEntry
All Implemented Interfaces:
Cloneable, CloneableObject, Map.Entry, Serializable

public class MapEntry
extends Object
implements Map.Entry, Serializable, CloneableObject

A simple implementation of the Map.Entry interface.

Author:
Allan Crooks
See Also:
Map.Entry, Serialized Form

Constructor Summary
MapEntry(Map.Entry e)
          Creates a new MapEntry based on another Map.Entry object.
MapEntry(Object key, Object value)
          Creates a new MapEntry.
 
Method Summary
 Object clone()
          Clones this MapEntry.
 boolean equals(Object obj)
          Compares this object to another object.
 boolean equalsKey(Map.Entry e)
          Compares this MapEntry's key to the key of another Map.Entry object.
 boolean equalsValue(Map.Entry e)
          Compares this MapEntry's value to the value of another Map.Entry object.
 Object getKey()
          Returns the key.
 Object getValue()
          Returns the value.
 int hashCode()
          Generates a hashcode for this object.
 Object setValue(Object obj)
          Sets the value.
 String toString()
          Generates a string repesentation of this object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapEntry

public MapEntry(Object key,
                Object value)
Creates a new MapEntry.
Parameters:
key - The key.
value - The value.

MapEntry

public MapEntry(Map.Entry e)
Creates a new MapEntry based on another Map.Entry object.
Parameters:
e - The Map.Entry to base this object on.
Throws:
NullPointerException - If e is null.
Method Detail

equalsKey

public final boolean equalsKey(Map.Entry e)
Compares this MapEntry's key to the key of another Map.Entry object.
Parameters:
e - The Entry object to compare it to.
Returns:
true if both objects have the same key.
Throws:
NullPointerException - If e is null.

equalsValue

public final boolean equalsValue(Map.Entry e)
Compares this MapEntry's value to the value of another Map.Entry object.
Parameters:
e - The Entry object to compare it to.
Returns:
true if both objects have the same value.
Throws:
NullPointerException - If e is null.

equals

public boolean equals(Object obj)
Compares this object to another object.
Specified by:
equals in interface Map.Entry
Overrides:
equals in class Object
Returns:
true if this object matches the provided object.

getKey

public final Object getKey()
Returns the key.
Specified by:
getKey in interface Map.Entry
Returns:
The key of this MapEntry.

getValue

public final Object getValue()
Returns the value.
Specified by:
getValue in interface Map.Entry
Returns:
The value of this MapEntry.

setValue

public Object setValue(Object obj)
Sets the value.
Specified by:
setValue in interface Map.Entry
Parameters:
value - The new value of this MapEntry.

hashCode

public int hashCode()
Generates a hashcode for this object. The hashcode is generated by performing:
    key.hashCode() ^ value.hashCode()
 
Specified by:
hashCode in interface Map.Entry
Overrides:
hashCode in class Object
Returns:
A hashcode for this object.

clone

public Object clone()
Clones this MapEntry.
Specified by:
clone in interface CloneableObject
Overrides:
clone in class Object
Returns:
A clone of this object.

toString

public String toString()
Generates a string repesentation of this object.
Overrides:
toString in class Object
Returns:
A string representation of this object.