Set<PsiElement> (@NotNull BitSet reached) { Set<PsiElement> result = new HashSet<>(); myElementToStartOffsetMap.forEach((element, start) -> { int end = myElementToEndOffsetMap.getOrDefault(element, -1); if (end == -1) return; int nextReached = reached.nextSetBit(start); if (nextReached == -1 || nextReached >= end) { result.add(element); } }); return result; }