for (BugInstance bug : newCollection.getCollection()) if (!mapFromNewToOldBug.containsKey(bug)) { newBugs++; LinkedList<BugInstance> q = set.get(bug); if (q != null && !q.isEmpty()) { matchedBugs++; BugInstance matchedBug = q.removeFirst(); mapFromNewToOldBug.put(bug, matchedBug); matchedOldBugs.add(matchedBug);
for (BugInstance bug : newCollection.getCollection()) if (!mapFromNewToOldBug.containsKey(bug)) { newBugs++; LinkedList<BugInstance> q = set.get(bug); if (q != null && !q.isEmpty()) { matchedBugs++; BugInstance matchedBug = q.removeFirst(); mapFromNewToOldBug.put(bug, matchedBug); matchedOldBugs.add(matchedBug); }
	private static void matchBugs(			Comparator<BugInstance> bugInstanceComparator,			BugCollection origCollection, BugCollection newCollection) {				TreeMap<BugInstance, LinkedList<BugInstance>> set = new TreeMap<BugInstance, LinkedList<BugInstance>>(				bugInstanceComparator);		int oldBugs = 0;		int newBugs = 0;		int matchedBugs = 0;		for (BugInstance bug : origCollection.getCollection())			if (bug.getLastVersion() == -1 && !matchedOldBugs.contains(bug)) {				oldBugs++;				LinkedList<BugInstance> q = set.get(bug);				if (q == null) {					q = new LinkedList<BugInstance>();					set.put(bug, q);				}				q.add(bug);			}		for (BugInstance bug : newCollection.getCollection()) if (!mapFromNewToOldBug.containsKey(bug)) {			newBugs++;			LinkedList<BugInstance> q = set.get(bug);			if (q != null && !q.isEmpty()) {				matchedBugs++;				BugInstance matchedBug = q.removeFirst();				mapFromNewToOldBug.put(bug, matchedBug);				matchedOldBugs.add(matchedBug);			}		}		if (false && verbose) System.out.println("matched " + matchedBugs + " of " + oldBugs +"o/" + newBugs  + "n bugs using " + bugInstanceComparator.getClass().getName()); 	}