org.jfree.data

Class DefaultKeyedValue

public class DefaultKeyedValue extends Object implements KeyedValue, Cloneable, PublicCloneable, Serializable

A (key, value) pair. This class provides a default implementation of the KeyedValue interface.
Constructor Summary
DefaultKeyedValue(Comparable key, Number value)
Creates a new (key, value) item.
Method Summary
Objectclone()
Returns a clone.
booleanequals(Object obj)
Tests this key-value pair for equality with an arbitrary object.
ComparablegetKey()
Returns the key.
NumbergetValue()
Returns the value.
inthashCode()
Returns a hash code.
voidsetValue(Number value)
Sets the value.

Constructor Detail

DefaultKeyedValue

public DefaultKeyedValue(Comparable key, Number value)
Creates a new (key, value) item.

Parameters: key the key (should be immutable). value the value (null permitted).

Method Detail

clone

public Object clone()
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.

equals

public boolean equals(Object obj)
Tests this key-value pair for equality with an arbitrary object.

Parameters: obj the object (null permitted).

Returns: A boolean.

getKey

public Comparable getKey()
Returns the key.

Returns: The key.

getValue

public Number getValue()
Returns the value.

Returns: The value (possibly null).

hashCode

public int hashCode()
Returns a hash code.

Returns: A hash code.

setValue

public void setValue(Number value)
Sets the value.

Parameters: value the value (null permitted).