Class DefaultKeyedValue

    • Constructor Detail

      • DefaultKeyedValue

        public DefaultKeyedValue​(Comparable key,
                                 Number value)
        Creates a new (key, value) item.
        Parameters:
        key - the key (should be immutable, null not permitted).
        value - the value (null permitted).
    • Method Detail

      • getKey

        public Comparable getKey()
        Returns the key.
        Specified by:
        getKey in interface KeyedValue
        Returns:
        The key (never null).
      • getValue

        public Number getValue()
        Returns the value.
        Specified by:
        getValue in interface Value
        Returns:
        The value (possibly null).
      • setValue

        public void setValue​(Number value)
        Sets the value.
        Parameters:
        value - the value (null permitted).
      • equals

        public boolean equals​(Object obj)
        Tests this key-value pair for equality with an arbitrary object.
        Overrides:
        equals in class Object
        Parameters:
        obj - the object (null permitted).
        Returns:
        A boolean.
      • hashCode

        public int hashCode()
        Returns a hash code.
        Overrides:
        hashCode in class Object
        Returns:
        A hash code.
      • clone

        public Object clone()
                     throws CloneNotSupportedException
        Returns a clone. It is assumed that both the key and value are immutable objects, so only the references are cloned, not the objects themselves.
        Specified by:
        clone in interface org.jfree.util.PublicCloneable
        Overrides:
        clone in class Object
        Returns:
        A clone.
        Throws:
        CloneNotSupportedException - Not thrown by this class, but subclasses (if any) might.
      • toString

        public String toString()
        Returns a string representing this instance, primarily useful for debugging.
        Overrides:
        toString in class Object
        Returns:
        A string.