Class DefaultKeyedValue

java.lang.Object
org.jfree.data.DefaultKeyedValue
All Implemented Interfaces:
Serializable, Cloneable, KeyedValue, Value

public class DefaultKeyedValue
extends Object
implements KeyedValue, Cloneable, Serializable
A (key, value) pair.

This class provides a default implementation of the KeyedValue interface.

See Also:
Serialized Form
  • Constructor Details

    • DefaultKeyedValue

      public DefaultKeyedValue​(Comparable key, Number value)
      Creates a new (key, value) pair.
      Parameters:
      key - the key.
      value - the value (null permitted).
  • Method Details

    • getKey

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

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

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

      public boolean equals​(Object o)
      Tests if this object is equal to another.
      Overrides:
      equals in class Object
      Parameters:
      o - the other object.
      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.
      Returns:
      A clone.
      Throws:
      CloneNotSupportedException - Not thrown by this class, but subclasses (if any) might.