Set<String> () { Set<String> usedScopeNames = new HashSet<>(); for (int i =0 ; i < myModel.size(); i ++) { FileSetDescriptor descriptor = myModel.get(i); if (descriptor instanceof NamedScopeDescriptor) { usedScopeNames.add(descriptor.getName()); } } return usedScopeNames; }