/** * 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 */ @Override public Object clone() { try { @SuppressWarnings("unchecked") FloatArrayList v = (FloatArrayList) 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(); } }
@Override protected void removeRange(int fromIndex, int toIndex) { checkForComodification(); parent.removeRange(parentOffset + fromIndex, parentOffset + toIndex); this.modCount = parent.modCount; this.size -= toIndex - fromIndex; }
@Override public void add(int index, Float e) { rangeCheckForAdd(index); checkForComodification(); parent.add(parentOffset + index, e); this.modCount = parent.modCount; this.size++; }
@Override public Float remove(int index) { rangeCheck(index); checkForComodification(); Float result = parent.remove(parentOffset + index); this.modCount = parent.modCount; this.size--; return result; }
@Override public boolean addAll(int index, Collection<? extends Float> c) { rangeCheckForAdd(index); int cSize = c.size(); if (cSize == 0) return false; checkForComodification(); parent.addAll(parentOffset + index, c); this.modCount = parent.modCount; this.size += cSize; return true; }