/** * Replaces the part of the receiver starting at <code>from</code> (inclusive) with all the * elements of the specified collection. Does not alter the size of the receiver. Replaces exactly * <tt>Math.max(0,Math.min(size()-from, other.size()))</tt> elements. * * @param from the index at which to copy the first element from the specified collection. * @param other Collection to replace part of the receiver * @exception IndexOutOfBoundsException index is out of range (index < 0 || index >= * size()). */ public void replaceFromWith(int from, java.util.Collection other) { checkRange(from, size()); java.util.Iterator e = other.iterator(); int index = from; int limit = Math.min(size() - from, other.size()); for (int i = 0; i < limit; i++) set(index++, ((Number) e.next()).longValue()); // delta }
/** * Inserts the specified element before the specified position into the receiver. Shifts the * element currently at that position (if any) and any subsequent elements to the right. * * @param index index before which the specified element is to be inserted (must be in [0,size]). * @param element element to be inserted. * @throws IndexOutOfBoundsException if <tt>index < 0 || index > size()</tt>. */ public void beforeInsert(int index, long element) { beforeInsertDummies(index, 1); set(index, element); }