## org.jfree.data
Class DefaultPieDataset

    java.lang.Object
      org.jfree.data.AbstractDataset
          org.jfree.data.DefaultPieDataset

All Implemented Interfaces:
  java.lang.Cloneable, Dataset, KeyedValues, java.io.ObjectInputValidation, PieDataset, java.io.Serializable, Values

Direct Known Subclasses:
  DefaultKeyedValuesDataset, JDBCPieDataset

public class DefaultPieDataset
extends AbstractDataset
implements PieDataset, java.lang.Cloneable, java.io.Serializable

A default implementation of the `PieDataset` interface.

See Also:
  Serialized Form

Constructor Summary
`DefaultPieDataset()` Constructs a new dataset, initially empty.
`DefaultPieDataset(KeyedValues data)` Creates a new dataset that uses the data from a `KeyedValues` instance.

Method Summary
`java.lang.Object` `clone()` Returns a clone.
`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 key.
`int` `getItemCount()` Returns the number of items in the dataset.
`java.lang.Comparable` `getKey(int item)` Returns the key for an item.
`java.util.List` `getKeys()` Returns the categories in the dataset.
`java.lang.Number` `getValue(java.lang.Comparable key)` Returns the data value associated with a key.
`java.lang.Number` `getValue(int item)` Returns a value.
`int` `hashCode()` Returns a hash code.
`void` `setValue(java.lang.Comparable key, double value)` Sets the data value for a key.
`void` `setValue(java.lang.Comparable key, java.lang.Number value)` Sets the data value for a key.

Methods inherited from class org.jfree.data.AbstractDataset
`addChangeListener, fireDatasetChanged, getGroup, notifyListeners, removeChangeListener, setGroup, validateObject`

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

Methods inherited from interface org.jfree.data.Dataset
`addChangeListener, getGroup, removeChangeListener, setGroup`

Constructor Detail

### DefaultPieDataset

    public DefaultPieDataset()

  Constructs a new dataset, initially empty.

### DefaultPieDataset

    public DefaultPieDataset(KeyedValues data)

  Creates a new dataset that uses the data from a `KeyedValues` instance.

Parameters:
  `data` - the data.

Method Detail

### getItemCount

    public int getItemCount()

  Returns the number of items in the dataset.

  Specified by:
    `getItemCount` in interface `Values`
  Returns:
    the item count.

### getKeys

    public java.util.List getKeys()

  Returns the categories in the dataset. The returned list is unmodifiable.

  Specified by:
    `getKeys` in interface `KeyedValues`
  Returns:
    the categories in the dataset.

### getKey

    public java.lang.Comparable getKey(int item)

  Returns the key for an item.

  Specified by:
    `getKey` in interface `KeyedValues`
  Parameters:
    `item` - the item index (zero-based).
  Returns:
    the category.

### getIndex

    public int getIndex(java.lang.Comparable key)

  Returns the index for a key.

  Specified by:
    `getIndex` in interface `KeyedValues`
  Parameters:
    `key` - the key.
  Returns:
    the key index.

### getValue

    public java.lang.Number getValue(int item)

  Returns a value.

  Specified by:
    `getValue` in interface `Values`
  Parameters:
    `item` - the value index.
  Returns:
    the value (possibly `null`).

### getValue

    public java.lang.Number getValue(java.lang.Comparable key)

  Returns the data value associated with a key.

  Specified by:
    `getValue` in interface `KeyedValues`
  Parameters:
    `key` - the key (`null` not permitted).
  Returns:
    the value (possibly `null`).

### setValue

    public void setValue(java.lang.Comparable key,
                         java.lang.Number value)

  Sets the data value for a key.

  Parameters:
    `key` - the key.
    `value` - the value.

### setValue

    public void setValue(java.lang.Comparable key,
                         double value)

  Sets the data value for a key.

  Parameters:
    `key` - the key.
    `value` - the value.

### equals

    public boolean equals(java.lang.Object o)

  Tests if this object is equal to another.

  Parameters:
    `o` - the other object.
  Returns:
    A boolean.

### hashCode

    public int hashCode()

  Returns a hash code.

  Returns:
    a hash code.

### clone

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

  Returns a clone.

  Overrides:
    `clone` in class `AbstractDataset`
  Returns:
    A clone.
  Throws:
    `java.lang.CloneNotSupportedException` - This class will not throw this exception, but subclasses (if any) might.