Example usage for org.jfree.data DefaultKeyedValues2D clone

List of usage examples for org.jfree.data DefaultKeyedValues2D clone

Introduction

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

Prototype

@Override
public Object clone() throws CloneNotSupportedException 

Source Link

Document

Returns a clone.

Usage

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

/**
 * Some checks for the clone() method./*from  www . j  a  va2 s . c  o m*/
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    DefaultKeyedValues2D v1 = new DefaultKeyedValues2D();
    v1.setValue(new Integer(1), "V1", "C1");
    v1.setValue(null, "V2", "C1");
    v1.setValue(new Integer(3), "V3", "C2");
    DefaultKeyedValues2D v2 = (DefaultKeyedValues2D) v1.clone();
    assertTrue(v1 != v2);
    assertTrue(v1.getClass() == v2.getClass());
    assertTrue(v1.equals(v2));

    // check that clone is independent of the original
    v2.setValue(new Integer(2), "V2", "C1");
    assertFalse(v1.equals(v2));
}