diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/CollectionRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/CollectionRules.java index 7a9802cb1f..bdcffa8661 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/CollectionRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/CollectionRules.java @@ -41,7 +41,8 @@ boolean before(Collection collection) { collection.size() == 0, collection.size() <= 0, collection.size() < 1, - Iterables.isEmpty(collection)); + Iterables.isEmpty(collection), + collection.stream().findAny().isEmpty()); } @BeforeTemplate diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestInput.java index 735587515c..56f194cd4d 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestInput.java @@ -29,7 +29,8 @@ ImmutableSet testCollectionIsEmpty() { ImmutableSet.of(5).size() > 0, ImmutableSet.of(6).size() >= 1, Iterables.isEmpty(ImmutableSet.of(7)), - ImmutableSet.of(8).asList().isEmpty()); + ImmutableSet.of(8).stream().findAny().isEmpty(), + ImmutableSet.of(9).asList().isEmpty()); } ImmutableSet testCollectionSize() { diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestOutput.java index cf2040e33b..96719dcdbf 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/CollectionRulesTestOutput.java @@ -29,7 +29,8 @@ ImmutableSet testCollectionIsEmpty() { !ImmutableSet.of(5).isEmpty(), !ImmutableSet.of(6).isEmpty(), ImmutableSet.of(7).isEmpty(), - ImmutableSet.of(8).isEmpty()); + ImmutableSet.of(8).isEmpty(), + ImmutableSet.of(9).isEmpty()); } ImmutableSet testCollectionSize() {