Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java
          +++ new/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java
↓ open down ↓ 539 lines elided ↑ open up ↑
 540  540      /**
 541  541       * Removes from this list all of the elements whose index is between
 542  542       * <tt>fromIndex</tt>, inclusive, and <tt>toIndex</tt>, exclusive.
 543  543       * Shifts any succeeding elements to the left (reduces their index).
 544  544       * This call shortens the list by <tt>(toIndex - fromIndex)</tt> elements.
 545  545       * (If <tt>toIndex==fromIndex</tt>, this operation has no effect.)
 546  546       *
 547  547       * @param fromIndex index of first element to be removed
 548  548       * @param toIndex index after last element to be removed
 549  549       * @throws IndexOutOfBoundsException if fromIndex or toIndex out of range
 550      -     *         (@code{fromIndex < 0 || toIndex > size() || toIndex < fromIndex})
      550 +     *         ({@code{fromIndex < 0 || toIndex > size() || toIndex < fromIndex})
 551  551       */
 552  552      private void removeRange(int fromIndex, int toIndex) {
 553  553          final ReentrantLock lock = this.lock;
 554  554          lock.lock();
 555  555          try {
 556  556              Object[] elements = getArray();
 557  557              int len = elements.length;
 558  558  
 559  559              if (fromIndex < 0 || toIndex > len || toIndex < fromIndex)
 560  560                  throw new IndexOutOfBoundsException();
↓ open down ↓ 421 lines elided ↑ open up ↑
 982  982      public ListIterator<E> listIterator(final int index) {
 983  983          Object[] elements = getArray();
 984  984          int len = elements.length;
 985  985          if (index<0 || index>len)
 986  986              throw new IndexOutOfBoundsException("Index: "+index);
 987  987  
 988  988          return new COWIterator<E>(elements, index);
 989  989      }
 990  990  
 991  991      private static class COWIterator<E> implements ListIterator<E> {
 992      -        /** Snapshot of the array **/
      992 +        /** Snapshot of the array */
 993  993          private final Object[] snapshot;
 994  994          /** Index of element to be returned by subsequent call to next.  */
 995  995          private int cursor;
 996  996  
 997  997          private COWIterator(Object[] elements, int initialCursor) {
 998  998              cursor = initialCursor;
 999  999              snapshot = elements;
1000 1000          }
1001 1001  
1002 1002          public boolean hasNext() {
↓ open down ↓ 333 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX