com.hp.hpl.jena.util
Class OneToManyMap.Entry

java.lang.Object
  |
  +--com.hp.hpl.jena.util.OneToManyMap.Entry
All Implemented Interfaces:
java.util.Map.Entry
Enclosing class:
OneToManyMap

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

Helper class to implement the Map.Entry interface to enumerate entries in the map


Method Summary
 boolean equals(java.lang.Object x)
          Compares the specified object with this entry for equality.
 java.lang.Object getKey()
          Answer the key for the entry
 java.lang.Object getValue()
          Answer the value for the entry
 int hashCode()
          Returns the hash code value for this map entry.
 java.lang.Object setValue(java.lang.Object value)
          Set the value, which writes through to the map.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equals

public boolean equals(java.lang.Object x)
Compares the specified object with this entry for equality. Returns true if the given object is also a map entry and the two entries represent the same mapping. More formally, two entries e1 and e2 represent the same mapping if
      (e1.getKey()==null ?
                         e2.getKey()==null : e1.getKey().equals(e2.getKey()))  &&
      (e1.getValue()==null ?
                         e2.getValue()==null : e1.getValue().equals(e2.getValue()))
 
This ensures that the equals method works properly across different implementations of the Map.Entry interface.
Specified by:
equals in interface java.util.Map.Entry
Overrides:
equals in class java.lang.Object
Parameters:
x - The object to compare against
Returns:
True if the given object is equal to this Map.Entry object.

getKey

public java.lang.Object getKey()
Answer the key for the entry
Specified by:
getKey in interface java.util.Map.Entry
Returns:
The key object

getValue

public java.lang.Object getValue()
Answer the value for the entry
Specified by:
getValue in interface java.util.Map.Entry
Returns:
The value object

setValue

public java.lang.Object setValue(java.lang.Object value)
                          throws java.lang.UnsupportedOperationException
Set the value, which writes through to the map. Not implemented.
Specified by:
setValue in interface java.util.Map.Entry

hashCode

public int hashCode()
Returns the hash code value for this map entry. The hash code of a map entry e is defined to be: (e.getKey()==null ? 0 : e.getKey().hashCode()) ^ (e.getValue()==null ? 0 : e.getValue().hashCode()) This ensures that e1.equals(e2) implies that e1.hashCode()==e2.hashCode() for any two Entries e1 and e2, as required by the general contract of Object.hashCode.
Specified by:
hashCode in interface java.util.Map.Entry
Overrides:
hashCode in class java.lang.Object


Copyright 2001 Hewlett-Packard. All Rights Reserved.