GlobalSearchScope (@NotNull Collection<? extends GlobalSearchScope> scopes) { if (scopes.isEmpty()) { throw new IllegalArgumentException("Empty scope collection"); } if (scopes.size() == 1) { return scopes.iterator().next(); } return UnionScope.create(scopes.toArray(EMPTY_ARRAY)); }