Minor, don't intersect sets, use retainAll instead

This commit is contained in:
Alexander Udalov
2014-05-05 18:58:32 +04:00
parent eb11a7dc88
commit beb66e2247
@@ -555,12 +555,12 @@ public class TypeUtils {
private static Set<JetType> getIntersectionOfSupertypes(@NotNull Collection<JetType> types) {
Set<JetType> upperBounds = Sets.newHashSet();
for (JetType type : types) {
Set<JetType> supertypes = Sets.newHashSet(type.getConstructor().getSupertypes());
Collection<JetType> supertypes = type.getConstructor().getSupertypes();
if (upperBounds.isEmpty()) {
upperBounds.addAll(supertypes);
}
else {
upperBounds = Sets.intersection(upperBounds, supertypes);
upperBounds.retainAll(supertypes);
}
}
return upperBounds;