void (List<? extends IdeaSourceDirectory> list, List<? extends IdeaSourceDirectory> toRemove) { Set<File> files = toRemove.stream().map(o -> o.getDirectory()).collect(Collectors.toSet()); list.removeIf(o -> files.contains(o.getDirectory())); }