Set<Module> () { Set<Module> modules = new HashSet<>(); OrderEnumerator en = getOrderEnumeratorForOptions(); en.forEach(each -> { if (each instanceof ModuleOrderEntry) { ContainerUtil.addIfNotNull(modules, ((ModuleOrderEntry)each).getModule()); } else if (each instanceof ModuleSourceOrderEntry) { ContainerUtil.addIfNotNull(modules, each.getOwnerModule()); } return true; }); return modules; }