From fa76c00a4f4342eb5e4cac42d9d32e4228e64704 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sat, 31 Aug 2024 17:34:29 -0400 Subject: [PATCH] Inline single use local variable --- src/main/java/org/apache/commons/collections4/SetUtils.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/SetUtils.java b/src/main/java/org/apache/commons/collections4/SetUtils.java index cf5e438b4..befd03ccd 100644 --- a/src/main/java/org/apache/commons/collections4/SetUtils.java +++ b/src/main/java/org/apache/commons/collections4/SetUtils.java @@ -276,8 +276,6 @@ public class SetUtils { Objects.requireNonNull(setA, "setA"); Objects.requireNonNull(setB, "setB"); - final Predicate containedInB = setB::contains; - return new SetView() { @Override public boolean contains(final Object o) { @@ -286,7 +284,7 @@ public class SetUtils { @Override public Iterator createIterator() { - return IteratorUtils.filteredIterator(setA.iterator(), containedInB); + return IteratorUtils.filteredIterator(setA.iterator(), setB::contains); } }; }