Skip to content

Commit

Permalink
Inline single use local variable
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Aug 31, 2024
1 parent deadbda commit fa76c00
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/main/java/org/apache/commons/collections4/SetUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,6 @@ public static <E> SetView<E> intersection(final Set<? extends E> setA, final Set
Objects.requireNonNull(setA, "setA");
Objects.requireNonNull(setB, "setB");

final Predicate<E> containedInB = setB::contains;

return new SetView<E>() {
@Override
public boolean contains(final Object o) {
Expand All @@ -286,7 +284,7 @@ public boolean contains(final Object o) {

@Override
public Iterator<E> createIterator() {
return IteratorUtils.filteredIterator(setA.iterator(), containedInB);
return IteratorUtils.filteredIterator(setA.iterator(), setB::contains);
}
};
}
Expand Down

0 comments on commit fa76c00

Please sign in to comment.