Set<String> (Module @Nullable [] modules, @Nullable List<? extends UnloadedModuleDescription> unloadedModules) { Set<String> moduleNamesToDelete = new HashSet<>(); if (null != modules) { for (var module : modules) { moduleNamesToDelete.add(module.getName()); } } if (unloadedModules != null) { for (var unloadedModule : unloadedModules) { moduleNamesToDelete.add(unloadedModule.getName()); } } return moduleNamesToDelete; }