/** * Returns a copy of the receiver such that the copy and the receiver <i>share</i> the same elements, but do not share the same array to index them; * So modifying an object in the copy modifies the object in the receiver and vice versa; * However, structurally modifying the copy (for example changing its size, setting other objects at indexes, etc.) does not affect the receiver and vice versa. * * @return a copy of the receiver. */ public Object clone() { ObjectArrayList v = (ObjectArrayList)super.clone(); v.elements = (Object[]) elements.clone(); return v; } /**
/** * Returns a copy of the receiver such that the copy and the receiver <i>share</i> the same elements, but do not share the same array to index them; * So modifying an object in the copy modifies the object in the receiver and vice versa; * However, structurally modifying the copy (for example changing its size, setting other objects at indexes, etc.) does not affect the receiver and vice versa. * * @return a copy of the receiver. */ public Object clone() { ObjectArrayList v = (ObjectArrayList)super.clone(); v.elements = (Object[]) elements.clone(); return v; } /**
/** * Returns a copy of the receiver such that the copy and the receiver * <i>share</i> the same elements, but do not share the same array to index * them; So modifying an object in the copy modifies the object in the * receiver and vice versa; However, structurally modifying the copy (for * example changing its size, setting other objects at indexes, etc.) does * not affect the receiver and vice versa. * * @return a copy of the receiver. */ public Object clone() { ObjectArrayList v = (ObjectArrayList) super.clone(); v.elements = elements.clone(); return v; }
/** * Returns a copy of the receiver such that the copy and the receiver * <i>share</i> the same elements, but do not share the same array to index * them; So modifying an object in the copy modifies the object in the * receiver and vice versa; However, structurally modifying the copy (for * example changing its size, setting other objects at indexes, etc.) does * not affect the receiver and vice versa. * * @return a copy of the receiver. */ public Object clone() { ObjectArrayList v = (ObjectArrayList) super.clone(); v.elements = (Object[]) elements.clone(); return v; }
/** * Returns a copy of the receiver such that the copy and the receiver * <i>share</i> the same elements, but do not share the same array to index * them; So modifying an object in the copy modifies the object in the * receiver and vice versa; However, structurally modifying the copy (for * example changing its size, setting other objects at indexes, etc.) does * not affect the receiver and vice versa. * * @return a copy of the receiver. */ public Object clone() { ObjectArrayList v = (ObjectArrayList) super.clone(); v.elements = elements.clone(); return v; }