void (List<? extends RelatedItemLineMarkerInfo> markers, List<? super GotoRelatedItem> result) { Set<PsiFile> addedFiles = new HashSet<>(); for (RelatedItemLineMarkerInfo<?> marker : markers) { Collection<? extends GotoRelatedItem> items = marker.createGotoRelatedItems(); for (GotoRelatedItem item : items) { PsiElement element = item.getElement(); if (element instanceof PsiFile file) { if (addedFiles.contains(file)) { continue; } } if (element != null) { ContainerUtil.addIfNotNull(addedFiles, element.getContainingFile()); } result.add(item); } } }