Example usage for org.jfree.data KeyedObject setObject

List of usage examples for org.jfree.data KeyedObject setObject

Introduction

In this page you can find the example usage for org.jfree.data KeyedObject setObject.

Prototype

public void setObject(Object object) 

Source Link

Document

Sets the object.

Usage

From source file:org.jfree.data.KeyedObjects.java

/**
 * Replaces an existing object, or adds a new object to the collection.
 * This is the same as the {@link #addObject(Comparable, Object)}
 * method./*from  w  w  w .  ja  va 2  s. co m*/
 *
 * @param key  the key (<code>null</code> not permitted).
 * @param object  the object.
 *
 * @see #getObject(Comparable)
 */
public void setObject(Comparable key, Object object) {
    int keyIndex = getIndex(key);
    if (keyIndex >= 0) {
        KeyedObject ko = (KeyedObject) this.data.get(keyIndex);
        ko.setObject(object);
    } else {
        KeyedObject ko = new KeyedObject(key, object);
        this.data.add(ko);
    }
}