List<OrderRoot> (List<OrderRoot> roots, LibraryTable.ModifiableModel moduleLibrariesModel) { if (roots == null || roots.isEmpty()) { return Collections.emptyList(); } Library[] libraries = moduleLibrariesModel.getLibraries(); if (libraries.length == 0) { return roots; } return roots.stream() .filter(root -> { return Arrays.stream(libraries).noneMatch(library -> ArrayUtil.contains(root.getFile(), library.getFiles(root.getType()))); }) .collect(Collectors.toList()); }