Configurable (Set<? extends Configurable> configurables, Set<? extends Configurable> hits) { Configurable candidate = null; for (Configurable configurable : configurables) { if (hits != null && hits.contains(configurable)) { return configurable; } if (candidate == null && !isEmptyParent(configurable)) { candidate = configurable; } } return candidate; }