afreechart/src/main/java/org/afree/util/ObjectUtilities.java
/**
     * Returns a new collection containing clones of all the items in the
     * specified collection.
     *
     * @param collection the collection (<code>null</code> not permitted).
     * @return A new collection containing clones of all the items in the
     *         specified collection.
     * @throws CloneNotSupportedException if any of the items in the collection
     *                                    cannot be cloned.
     */
Returns a new collection containing clones of all the items in the
specified collection.

@param collection the collection (null not permitted).
@return A new collection containing clones of all the items in the
specified collection.
@throws CloneNotSupportedException if any of the items in the collection
cannot be cloned.
Returns a new collection containing clones of all the items in the specified collection . @param collection the collection ( null not permitted ) . @return A new collection containing clones of all the items in the specified collection . @throws CloneNotSupportedException if any of the items in the collection cannot be cloned .
public static Collection deepClone(final Collection collection)
        throws CloneNotSupportedException {
        if (collection == null) {
            throw new IllegalArgumentException("Null 'collection' argument.");
        }
        final Collection result
            = (Collection) ObjectUtilities.clone(collection);
        result.clear();
        final Iterator iterator = collection.iterator();
        while (iterator.hasNext()) {
            final Object item = iterator.next();
            if (item != null) {
                result.add(clone(item));
            }
            else {
                result.add(null);
            }
        }
        return result;
    }
public static Collection deepClone ( final Collection collection ) throws CloneNotSupportedException { if ( collection == null ) { throw new IllegalArgumentException ( "Null 'collection' argument." ) ; } final Collection result = ( Collection ) ObjectUtilities . clone ( collection ) ; result . clear ( ) ; final Iterator iterator = collection . iterator ( ) ; while ( iterator . hasNext ( ) ) { final Object item = iterator . next ( ) ; if ( item != null ) { result . add ( clone ( item ) ) ; } else { result . add ( null ) ; } } return result ; }
Returns a new collection containing clones of all the items in the
 specified collection.
Returns a new collection containing clones of all the items in the specified collection .
// all JDK-Collections are cloneable ... // and if the collection is not clonable, then we should throw // a CloneNotSupportedException anyway ...