void (@NotNull List<ScheduledPass> freePasses, @NotNull Int2ObjectMap<ScheduledPass> toBeSubmitted, @NotNull AtomicInteger threadsToStartCountdown) { assert threadsToStartCountdown.get() == toBeSubmitted.size(); Map<ScheduledPass, Pair<ScheduledPass, Integer>> id2Visits = CollectionFactory.createCustomHashingStrategyMap(new HashingStrategy<>() { @Override public int hashCode(@Nullable PassExecutorService.ScheduledPass sp) { if (sp == null) return 0; return ((TextEditorHighlightingPass)sp.myPass).getId() * 31 + sp.myFileEditor.hashCode(); } @Override public boolean equals(@Nullable PassExecutorService.ScheduledPass sp1, @Nullable PassExecutorService.ScheduledPass sp2) { if (sp1 == null || sp2 == null) return sp1 == sp2; int id1 = ((TextEditorHighlightingPass)sp1.myPass).getId(); int id2 = ((TextEditorHighlightingPass)sp2.myPass).getId(); return id1 == id2 && sp1.myFileEditor == sp2.myFileEditor; } }); for (ScheduledPass freePass : freePasses) { HighlightingPass pass = freePass.myPass; if (pass instanceof TextEditorHighlightingPass) { id2Visits.put(freePass, Pair.create(freePass, 0)); checkConsistency(freePass, id2Visits); } } for (Map.Entry<ScheduledPass, Pair<ScheduledPass, Integer>> entry : id2Visits.entrySet()) { int count = entry.getValue().second; assert count == 0 : entry.getKey(); } assert id2Visits.size() == threadsToStartCountdown.get() : "Expected "+threadsToStartCountdown+" but got "+id2Visits.size()+": "+id2Visits; }