Example usage for org.jfree.data.general DefaultKeyedValues2DDataset clone

List of usage examples for org.jfree.data.general DefaultKeyedValues2DDataset clone

Introduction

In this page you can find the example usage for org.jfree.data.general DefaultKeyedValues2DDataset clone.

Prototype

@Override
public Object clone() throws CloneNotSupportedException 

Source Link

Document

Returns a clone of the dataset.

Usage

From source file:org.jfree.data.general.DefaultKeyedValues2DDatasetTest.java

/**
 * Confirm that cloning works.//from w  w  w. ja va2  s  .  c o m
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    DefaultKeyedValues2DDataset d1 = new DefaultKeyedValues2DDataset();
    d1.setValue(new Integer(1), "V1", "C1");
    d1.setValue(null, "V2", "C1");
    d1.setValue(new Integer(3), "V3", "C2");
    DefaultKeyedValues2DDataset d2 = (DefaultKeyedValues2DDataset) d1.clone();
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));
}