Class AbstractKeyValue

  • All Implemented Interfaces:
    KeyValue
    Direct Known Subclasses:
    AbstractMapEntry, DefaultKeyValue

    public abstract class AbstractKeyValue
    extends java.lang.Object
    implements KeyValue
    Abstract pair class to assist with creating KeyValue and Map.Entry implementations.
    Since:
    Commons Collections 3.0
    Version:
    $Revision: 646777 $ $Date: 2008-04-10 14:33:15 +0200 (Thu, 10 Apr 2008) $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Object key
      The key
      protected java.lang.Object value
      The value
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractKeyValue​(java.lang.Object key, java.lang.Object value)
      Constructs a new pair with the specified key and given value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getKey()
      Gets the key from the pair.
      java.lang.Object getValue()
      Gets the value from the pair.
      java.lang.String toString()
      Gets a debugging String view of the pair.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • key

        protected java.lang.Object key
        The key
      • value

        protected java.lang.Object value
        The value
    • Constructor Detail

      • AbstractKeyValue

        protected AbstractKeyValue​(java.lang.Object key,
                                   java.lang.Object value)
        Constructs a new pair with the specified key and given value.
        Parameters:
        key - the key for the entry, may be null
        value - the value for the entry, may be null
    • Method Detail

      • getKey

        public java.lang.Object getKey()
        Gets the key from the pair.
        Specified by:
        getKey in interface KeyValue
        Returns:
        the key
      • getValue

        public java.lang.Object getValue()
        Gets the value from the pair.
        Specified by:
        getValue in interface KeyValue
        Returns:
        the value
      • toString

        public java.lang.String toString()
        Gets a debugging String view of the pair.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String view of the entry