Package org.jfree.data
Class DefaultKeyedValue<K extends Comparable<K>>
java.lang.Object
org.jfree.data.DefaultKeyedValue<K>
- Type Parameters:
K
- the key type (String
is a good default).
- All Implemented Interfaces:
Serializable
,Cloneable
,PublicCloneable
,KeyedValue<K>
,Value
public class DefaultKeyedValue<K extends Comparable<K>>
extends Object
implements KeyedValue<K>, Cloneable, PublicCloneable, Serializable
A (key, value) pair. This class provides a default implementation of the
KeyedValue
interface.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone.boolean
Tests this key-value pair for equality with an arbitrary object.getKey()
Returns the key.getValue()
Returns the value.int
hashCode()
Returns a hash code.void
Sets the value.toString()
Returns a string representing this instance, primarily useful for debugging.
-
Constructor Details
-
DefaultKeyedValue
Creates a new (key, value) item.- Parameters:
key
- the key (should be immutable,null
not permitted).value
- the value (null
permitted).
-
-
Method Details
-
getKey
Returns the key.- Specified by:
getKey
in interfaceKeyedValue<K extends Comparable<K>>
- Returns:
- The key (never
null
).
-
getValue
Returns the value. -
setValue
Sets the value.- Parameters:
value
- the value (null
permitted).
-
equals
Tests this key-value pair for equality with an arbitrary object. -
hashCode
Returns a hash code. -
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.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classObject
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- Not thrown by this class, but subclasses (if any) might.
-
toString
Returns a string representing this instance, primarily useful for debugging.
-