Esempio n. 1
0
 /**
  * Replaces a number of elements in the receiver with the same number of elements of another list.
  * Replaces elements in the receiver, between <code>from</code> (inclusive) and <code>to</code>
  * (inclusive), with elements of <code>other</code>, starting from <code>otherFrom</code>
  * (inclusive).
  *
  * @param from the position of the first element to be replaced in the receiver
  * @param to the position of the last element to be replaced in the receiver
  * @param other list holding elements to be copied into the receiver.
  * @param otherFrom position of first element within other list to be copied.
  */
 public void replaceFromToWithFrom(int from, int to, AbstractByteList other, int otherFrom) {
   // overridden for performance only.
   if (!(other instanceof ByteArrayList)) {
     // slower
     super.replaceFromToWithFrom(from, to, other, otherFrom);
     return;
   }
   int length = to - from + 1;
   if (length > 0) {
     checkRangeFromTo(from, to, size());
     checkRangeFromTo(otherFrom, otherFrom + length - 1, other.size());
     System.arraycopy(((ByteArrayList) other).elements, otherFrom, elements, from, length);
   }
 }