Class OneToManyMap.Entry<From,To>

java.lang.Object
org.apache.jena.util.OneToManyMap.Entry<From,To>
All Implemented Interfaces:
Map.Entry<From,To>
Enclosing class:
OneToManyMap<From,To>

public static class OneToManyMap.Entry<From,To> extends Object implements Map.Entry<From,To>
Helper class to implement the Map.Entry interface to enumerate entries in the map
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares the specified object with this entry for equality.
    Answer the key for the entry
    Answer the value for the entry
    int
    Returns the hash code value for this map entry.
    setValue(To 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 Details

    • equals

      public boolean equals(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 Map.Entry<From,To>
      Overrides:
      equals in class Object
      Parameters:
      x - The object to compare against
      Returns:
      True if the given object is equal to this Map.Entry object.
    • getKey

      public From getKey()
      Answer the key for the entry
      Specified by:
      getKey in interface Map.Entry<From,To>
      Returns:
      The key object
    • getValue

      public To getValue()
      Answer the value for the entry
      Specified by:
      getValue in interface Map.Entry<From,To>
      Returns:
      The value object
    • setValue

      public To setValue(To value) throws UnsupportedOperationException
      Set the value, which writes through to the map. Not implemented.
      Specified by:
      setValue in interface Map.Entry<From,To>
      Throws:
      UnsupportedOperationException
    • 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 Map.Entry<From,To>
      Overrides:
      hashCode in class Object