public ListIterator listIterator(int index) { // must synchronize to atomically obtain the array and length synchronized (CopyOnWriteArrayList.this) { if (index < 0 || index >= length) { throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + length); } Object[] array = getArray(); if (array != expectedArray) throw new ConcurrentModificationException(); return new COWSubIterator(array, offset, offset+length, offset+index); } }
public ListIterator listIterator(int index) { // must synchronize to atomically obtain the array and length synchronized (CopyOnWriteArrayList.this) { if (index < 0 || index >= length) { throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + length); } Object[] array = getArray(); if (array != expectedArray) throw new ConcurrentModificationException(); return new COWSubIterator(array, offset, offset+length, offset+index); } }
public ListIterator listIterator(int index) { // must synchronize to atomically obtain the array and length synchronized (CopyOnWriteArrayList.this) { if (index < 0 || index >= length) { throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + length); } Object[] array = getArray(); if (array != expectedArray) throw new ConcurrentModificationException(); return new COWSubIterator(array, offset, offset+length, offset+index); } }
public ListIterator listIterator() { // must synchronize to atomically obtain the array and length synchronized (CopyOnWriteArrayList.this) { Object[] array = getArray(); if (array != expectedArray) throw new ConcurrentModificationException(); return new COWSubIterator(array, offset, offset+length, offset); } }
public ListIterator listIterator() { // must synchronize to atomically obtain the array and length synchronized (CopyOnWriteArrayList.this) { Object[] array = getArray(); if (array != expectedArray) throw new ConcurrentModificationException(); return new COWSubIterator(array, offset, offset+length, offset); } }
public ListIterator listIterator() { // must synchronize to atomically obtain the array and length synchronized (CopyOnWriteArrayList.this) { Object[] array = getArray(); if (array != expectedArray) throw new ConcurrentModificationException(); return new COWSubIterator(array, offset, offset+length, offset); } }