/** * Returns a shallow copy of this <tt>ArrayList</tt> instance. (The elements themselves are not * copied.) * * @return a clone of this <tt>ArrayList</tt> instance */ public Object clone() { try { @SuppressWarnings("unchecked") FastArrayList<E> v = (FastArrayList<E>) super.clone(); v.elementData = Arrays.copyOf(elementData, size); v.modCount = 0; return v; } catch (CloneNotSupportedException e) { // this shouldn't happen, since we are Cloneable throw new InternalError(); } }
public boolean addAll(int index, Collection<? extends E> c) { int cSize = c.size(); if (cSize == 0) return false; parent.addAll(parentOffset + index, c); this.modCount = parent.modCount; this.size += cSize; return true; }
protected void removeRange(int fromIndex, int toIndex) { parent.removeRange(parentOffset + fromIndex, parentOffset + toIndex); this.modCount = parent.modCount; this.size -= toIndex - fromIndex; }
public E remove(int index) { E result = parent.remove(parentOffset + index); this.modCount = parent.modCount; this.size--; return result; }
public void add(int index, E e) { parent.add(parentOffset + index, e); this.modCount = parent.modCount; this.size++; }