Package org.jfree.data
Class DefaultKeyedValue<K extends Comparable<K>>
java.lang.Object
org.jfree.data.DefaultKeyedValue<K>
- Type Parameters:
K- the key type (Stringis 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a clone.booleanTests this key-value pair for equality with an arbitrary object.getKey()Returns the key.getValue()Returns the value.inthashCode()Returns a hash code.voidSets 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,nullnot permitted).value- the value (nullpermitted).
-
-
Method Details
-
getKey
Returns the key.- Specified by:
getKeyin interfaceKeyedValue<K extends Comparable<K>>- Returns:
- The key (never
null).
-
getValue
Returns the value. -
setValue
Sets the value.- Parameters:
value- the value (nullpermitted).
-
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:
clonein interfacePublicCloneable- Overrides:
clonein 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.
-