/** * Returns a clone of this object that is deep in the sense that all of the children objects are * cloned. * * @return A deep clone of this object. **/ public Object clone() { LinkedVector clone = (LinkedVector) super.clone(); clone.children = (Vector) clone.children.clone(); // This may look inefficient, but there is a purpose. Subclasses of // LinkedVector that don't define any new non-primitive member fields will // not need to override this method, as it already produces an object of // the subclass's type. for (int i = 0; i < size(); ++i) clone.insert((LinkedChild) clone.remove(i).clone(), i); return clone; } }