Class MapEntry

  • All Implemented Interfaces:
    java.util.Map.Entry

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

    Map.Entry implementation that can be constructed to either be read-only or not.

    Version:
    $Revision: 480477 $ $Date: 2006-11-29 08:34:52 +0000 (Wed, 29 Nov 2006) $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Object key
      The entry key.
      private boolean modifiable
      Whether the entry can be modified.
      private java.lang.Object value
      The entry value.
    • Constructor Summary

      Constructors 
      Constructor Description
      MapEntry​(java.lang.Object key, java.lang.Object value, boolean modifiable)
      Creates a map entry that can either allow modifications or not.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Determines if this entry is equal to the passed object.
      java.lang.Object getKey()
      Gets the entry key.
      java.lang.Object getValue()
      Gets the entry value.
      int hashCode()
      Returns the hashcode for this entry.
      java.lang.Object setValue​(java.lang.Object val)
      Sets the entry value if the entry can be modified.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • key

        private java.lang.Object key

        The entry key.

      • value

        private java.lang.Object value

        The entry value.

      • modifiable

        private boolean modifiable

        Whether the entry can be modified.

    • Constructor Detail

      • MapEntry

        public MapEntry​(java.lang.Object key,
                        java.lang.Object value,
                        boolean modifiable)

        Creates a map entry that can either allow modifications or not.

        Parameters:
        key - The entry key
        value - The entry value
        modifiable - Whether the entry should allow modification or not
    • Method Detail

      • getKey

        public java.lang.Object getKey()

        Gets the entry key.

        Specified by:
        getKey in interface java.util.Map.Entry
        Returns:
        The entry key
      • getValue

        public java.lang.Object getValue()

        Gets the entry value.

        Specified by:
        getValue in interface java.util.Map.Entry
        Returns:
        The entry key
      • setValue

        public java.lang.Object setValue​(java.lang.Object val)

        Sets the entry value if the entry can be modified.

        Specified by:
        setValue in interface java.util.Map.Entry
        Parameters:
        val - The new value
        Returns:
        The old entry value
        Throws:
        java.lang.UnsupportedOperationException - If the entry cannot be modified
      • equals

        public boolean equals​(java.lang.Object o)

        Determines if this entry is equal to the passed object.

        Specified by:
        equals in interface java.util.Map.Entry
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - The object to test
        Returns:
        True if equal, else false
      • hashCode

        public int hashCode()

        Returns the hashcode for this entry.

        Specified by:
        hashCode in interface java.util.Map.Entry
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        The and'ed hashcode of the key and value