From e30b4d37007c27ac866983c5be14551d420dd15d Mon Sep 17 00:00:00 2001 From: Arturo Bernal Date: Fri, 4 Mar 2022 14:58:30 +0100 Subject: [PATCH] Use java 8 and method reference. (#274) --- src/main/java/org/apache/commons/collections4/SetUtils.java | 2 +- .../commons/collections4/bloomfilter/HasherBloomFilter.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/SetUtils.java b/src/main/java/org/apache/commons/collections4/SetUtils.java index 3c3beea4f..58fd6d78e 100644 --- a/src/main/java/org/apache/commons/collections4/SetUtils.java +++ b/src/main/java/org/apache/commons/collections4/SetUtils.java @@ -277,7 +277,7 @@ public class SetUtils { Objects.requireNonNull(setA, "setA"); Objects.requireNonNull(setB, "setB"); - final Predicate containedInB = object -> setB.contains(object); + final Predicate containedInB = setB::contains; return new SetView() { @Override diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilter.java index 1124f4844..1ae2b79d1 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilter.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilter.java @@ -80,9 +80,7 @@ public class HasherBloomFilter extends AbstractBloomFilter { public boolean contains(final Hasher hasher) { verifyHasher(hasher); final Set set = new TreeSet<>(); - hasher.iterator(getShape()).forEachRemaining((IntConsumer) idx -> { - set.add(idx); - }); + hasher.iterator(getShape()).forEachRemaining((IntConsumer) set::add); final OfInt iter = this.hasher.iterator(getShape()); while (iter.hasNext()) { final int idx = iter.nextInt();