Exemplo n.º 1
0
 /**
  * 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 &lt; 0 || index &gt;=
  *     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
 }
Exemplo n.º 2
0
 /**
  * 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 &lt; 0 || index &gt; size()</tt>.
  */
 public void beforeInsert(int index, long element) {
   beforeInsertDummies(index, 1);
   set(index, element);
 }