JBIterable<FoundItemDescriptor<PsiFileSystemItem>> (@NotNull Iterable<? extends FoundItemDescriptor<PsiFileSystemItem>> iterable) { List<FoundItemDescriptor<PsiFileSystemItem>> dirs = new ArrayList<>(); return JBIterable.<FoundItemDescriptor<PsiFileSystemItem>>from(iterable).filter(res -> { if (res.getItem() instanceof PsiDirectory) { dirs.add(new FoundItemDescriptor<>(res.getItem(), DIRECTORY_MATCH_DEGREE)); return false; } return true; }).append(dirs); }