Collection<Configuration> () { if (configurations.isEmpty()) { return getProject().getConfigurations(); } Collection<Configuration> selectedProjectConfigurations = new ArrayList<>(); for (String configurationName : configurations) { Configuration configuration = getProject().getConfigurations().findByName(configurationName); if (configuration != null) { selectedProjectConfigurations.add(configuration); } } return selectedProjectConfigurations; }