@SuppressWarnings("unchecked")
public E next() {
checkForComodification();
int i = cursor;
if (i >= size)
thrownew NoSuchElementException();
//使用ArrayList.this是为了访问外部类中的数据,防止获取到内部类本身的数据
Object[] elementData = ArrayList.this.elementData;
if (i >= elementData.length)
thrownew ConcurrentModificationException();
cursor = i + 1;
return (E) elementData[lastRet = i];
}
1.数组中元素的移动都是使用 System.arraycopy(Object src, int srcPos, Object dest, int destPos, int length)的本地方法实现的2.在remove方法中:移除元素之后要将之前元素占用的位置设为null方便GC回收3.在batchRemove中使用if (c.contains(elementData[r]) == complem