This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 0cce8df410b8399df6db792ad78f496648eb2e1a
Author: Gary D. Gregory <[email protected]>
AuthorDate: Sun Feb 9 18:26:55 2025 -0500

    Add Checkstyle StringLiteralEquality
---
 src/conf/checkstyle.xml                                                 | 1 +
 .../apache/commons/collections4/collection/CompositeCollectionTest.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 4cf6e97e6..2d45782a1 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -86,6 +86,7 @@ limitations under the License.
     <module name="RightCurly"/>
     <module name="SimplifyBooleanExpression" />
     <module name="SimplifyBooleanReturn" />
+    <module name="StringLiteralEquality" />
     <module name="TypecastParenPad" />    
     <module name="UpperEll" />
     <module name="UnusedImports"/>
diff --git 
a/src/test/java/org/apache/commons/collections4/collection/CompositeCollectionTest.java
 
b/src/test/java/org/apache/commons/collections4/collection/CompositeCollectionTest.java
index ed576d61f..4a2750d9d 100644
--- 
a/src/test/java/org/apache/commons/collections4/collection/CompositeCollectionTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/collection/CompositeCollectionTest.java
@@ -380,7 +380,7 @@ public class CompositeCollectionTest<E> extends 
AbstractCollectionTest<E> {
         two.add((E) "2");
         two.add((E) "1");
         // need separate list to remove, as otherwise one clears itself
-        final Predicate<E> predicate = e -> e == "1";
+        final Predicate<E> predicate = e -> "1".equals(e);
         c.addComposited(one, two);
         c.removeIf(predicate);
         assertFalse(c.contains("1"));

Reply via email to