## org.jfree.data
Class KeyedObjects

    java.lang.Object
      org.jfree.data.KeyedObjects

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, org.jfree.util.PublicCloneable

    public class KeyedObjects

extends java.lang.Object
implements java.lang.Cloneable, org.jfree.util.PublicCloneable, java.io.Serializable

A collection of (key, object) pairs.

See Also:
  Serialized Form

Constructor Summary
`KeyedObjects()` Creates a new collection (initially empty).

Method Summary
`void` `addObject(java.lang.Comparable key, java.lang.Object object)` Adds a new object to the collection, or overwrites an existing object.
`java.lang.Object` `clone()` Returns a clone of this object.
`boolean` `equals(java.lang.Object o)` Tests if this object is equal to another.
`int` `getIndex(java.lang.Comparable key)` Returns the index for a given key.
`int` `getItemCount()` Returns the number of items (values) in the collection.
`java.lang.Comparable` `getKey(int index)` Returns a key.
`java.util.List` `getKeys()` Returns the keys.
`java.lang.Object` `getObject(java.lang.Comparable key)` Returns the object for a given key.
`java.lang.Object` `getObject(int item)` Returns an object.
`void` `removeValue(java.lang.Comparable key)` Removes a value from the collection.
`void` `removeValue(int index)` Removes a value from the collection.
`void` `setObject(java.lang.Comparable key, java.lang.Object object)` Replaces an existing object, or adds a new object to the collection.

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### KeyedObjects

    public KeyedObjects()

  Creates a new collection (initially empty).

Method Detail

### getItemCount

    public int getItemCount()

  Returns the number of items (values) in the collection.

  Returns:
    The item count.

### getObject

    public java.lang.Object getObject(int item)

  Returns an object.

  Parameters:
    `item` - the item index (zero-based).
  Returns:
    The object (`null` if the index is out of range).

### getKey

    public java.lang.Comparable getKey(int index)

  Returns a key.

  Parameters:
    `index` - the item index (zero-based).
  Returns:
    The row key.
  Throws:
    `java.lang.IndexOutOfBoundsException` - if `index` is out of bounds.

### getIndex

    public int getIndex(java.lang.Comparable key)

  Returns the index for a given key.

  Parameters:
    `key` - the key.
  Returns:
    The index, or `-1` if the key is unrecognised.

### getKeys

    public java.util.List getKeys()

  Returns the keys.

  Returns:
    The keys (never `null`).

### getObject

    public java.lang.Object getObject(java.lang.Comparable key)

  Returns the object for a given key. If the key is not recognised, the method should return `null`.

  Parameters:
    `key` - the key.
  Returns:
    The object (possibly `null`).

### addObject

    public void addObject(java.lang.Comparable key,
                          java.lang.Object object)

  Adds a new object to the collection, or overwrites an existing object. This is the same as the `setObject(Comparable, Object)` method.

  Parameters:
    `key` - the key.
    `object` - the object.

### setObject

    public void setObject(java.lang.Comparable key,
                          java.lang.Object object)

  Replaces an existing object, or adds a new object to the collection. This is the same as the `addObject(Comparable, Object)` method.

  Parameters:
    `key` - the key.
    `object` - the object.

### removeValue

    public void removeValue(int index)

  Removes a value from the collection.

  Parameters:
    `index` - the index of the item to remove.

### removeValue

    public void removeValue(java.lang.Comparable key)

  Removes a value from the collection.

  Parameters:
    `key` - the key of the item to remove.

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Returns a clone of this object.

  Specified by:
    `clone` in interface `org.jfree.util.PublicCloneable`
  Overrides:
    `clone` in class `java.lang.Object`
  Returns:
    A clone.
  Throws:
    `java.lang.CloneNotSupportedException` - if there is a problem cloning.

### equals

    public boolean equals(java.lang.Object o)

  Tests if this object is equal to another.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `o` - the other object.
  Returns:
    A boolean.