void () { if (modCount != startModCount) throw new ConcurrentModificationException(); curIndex = nextIndex; curElement = nextElement; nextElement = null; nextIndex = -1; for (int i = curIndex + 1; i < myList.size(); i++) { Reference<T> ref = myList.get(i); T t = ref == null ? null : ref.get(); if (t != null) { nextElement = t; nextIndex = i; break; } } if (nextIndex == -1 && modified) { modCount++; } }