Iterator<BugInstance> i = origSet.iterator(); while (i.hasNext()) { BugInstance orig = i.next();
for (BugInstance orig : origSet) {
	public void execute() {		DetectorFactoryCollection.instance(); // as a side effect, loads detector plugins		SortedSet<BugInstance> origSet = createSet(origCollection);		SortedSet<BugInstance> newSet = createSet(newCollection);		Iterator<BugInstance> i = origSet.iterator();		while (i.hasNext()) {			BugInstance orig = i.next();			if (preserveUnconditionally(orig)) {				// This original bug is not in a category that we are updating.				// Therefore, it is copied into the results unconditionally.				numPreserved++;				newCollection.add(orig);			} else {				// This original bug is in an updated category.				// So, to be preserved, it must also be in the new set.				if (newSet.contains(orig)) {					SortedSet<BugInstance> tailSet = newSet.tailSet(orig);					BugInstance matching = tailSet.first();					if (matching.getAnnotationText().equals("")) {						// Copy annotation text from original results to results						matching.setAnnotationText(orig.getAnnotationText());						numPreserved++;					} else {						numAlreadyAnnotated++;					}				} else {					numLost++;					if (!orig.getAnnotationText().equals("")) {						lostWithAnnotation(orig);						numLostWithAnnotations++;					}				}			}		}	}