List of usage examples for org.jfree.data KeyToGroupMap clone
private static Collection clone(Collection list) throws CloneNotSupportedException
From source file:org.jfree.data.KeyToGroupMap.java
/** * Returns a clone of the map./*from ww w . j a va2s. c o m*/ * * @return A clone. * * @throws CloneNotSupportedException if there is a problem cloning the * map. */ @Override public Object clone() throws CloneNotSupportedException { KeyToGroupMap result = (KeyToGroupMap) super.clone(); result.defaultGroup = (Comparable) KeyToGroupMap.clone(this.defaultGroup); result.groups = (List) KeyToGroupMap.clone(this.groups); result.keyToGroupMap = (Map) KeyToGroupMap.clone(this.keyToGroupMap); return result; }
From source file:org.jfree.data.KeyToGroupMap.java
/** * Returns a clone of the list./* w w w. j a v a 2 s. co m*/ * * @param list the list. * * @return A clone of the list. * * @throws CloneNotSupportedException if the list could not be cloned. */ private static Collection clone(Collection list) throws CloneNotSupportedException { Collection result = null; if (list != null) { try { List clone = (List) list.getClass().newInstance(); Iterator iterator = list.iterator(); while (iterator.hasNext()) { clone.add(KeyToGroupMap.clone(iterator.next())); } result = clone; } catch (Exception e) { throw new CloneNotSupportedException("Exception."); } } return result; }