Return as soon as we find multiple elements.
RELNOTES=n/a
@@ -693,8 +693,15 @@ public class IterableSubject extends Subject {
return false;
}
- private static boolean hasMultiple(Iterable<Entry<?>> list) {
- return totalCount(list) > 1;
+ private static boolean hasMultiple(Iterable<Entry<?>> entries) {
+ int totalCount = 0;
+ for (Multiset.Entry<?> entry : entries) {
+ totalCount += entry.getCount();
+ if (totalCount > 1) {
+ return true;
+ }
+ }
+ return false;
}
private static boolean containsEmptyOrLong(Iterable<Entry<?>> entries) {
@@ -709,14 +716,6 @@ public class IterableSubject extends Subject {
return totalLength > 200;
}
- private static int totalCount(Iterable<Entry<?>> entries) {
- int totalCount = 0;
- for (Multiset.Entry<?> entry : entries) {
- totalCount += entry.getCount();
- }
- return totalCount;
- }
-
/**
* Whether to output each missing/unexpected item as its own {@link Fact} or to group all those
* items together into a single {@code Fact}.
