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


The following commit(s) were added to refs/heads/master by this push:
     new c182f6561 Better lambdas
c182f6561 is described below

commit c182f65613c8e21100a1b272940e08b23320d158
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Wed Sep 13 18:10:39 2023 -0400

    Better lambdas
    
    Use final
    Initialize Map when instantiating
    Use diamonds
    Use varargs
---
 .../bloomfilter/ArrayCountingBloomFilter.java      |  6 +-
 .../collections4/bloomfilter/BloomFilter.java      | 12 ++--
 .../collections4/bloomfilter/CellProducer.java     | 12 ++--
 .../bloomfilter/CountingBloomFilter.java           | 12 ++--
 .../collections4/bloomfilter/IndexProducer.java    |  4 +-
 .../collections4/bloomfilter/IndexUtils.java       |  2 +-
 .../org/apache/commons/collections4/BulkTest.java  |  2 +-
 .../commons/collections4/CollectionUtilsTest.java  |  3 +-
 .../apache/commons/collections4/ListUtilsTest.java |  2 +-
 .../apache/commons/collections4/MapUtilsTest.java  |  2 +-
 .../apache/commons/collections4/SetUtilsTest.java  |  2 +-
 .../collections4/bag/PredicatedBagTest.java        |  2 +-
 .../collections4/bag/PredicatedSortedBagTest.java  |  2 +-
 .../bloomfilter/AbstractBitMapProducerTest.java    |  6 +-
 .../bloomfilter/AbstractBloomFilterTest.java       | 28 ++++----
 .../bloomfilter/AbstractCellProducerTest.java      |  6 +-
 .../AbstractCountingBloomFilterTest.java           | 36 +++++-----
 .../bloomfilter/AbstractIndexProducerTest.java     |  2 +-
 .../collections4/bloomfilter/BitMapTest.java       |  2 +-
 .../bloomfilter/DefaultBitMapProducerTest.java     | 13 ++--
 .../bloomfilter/DefaultBloomFilterTest.java        | 16 ++---
 .../bloomfilter/DefaultIndexProducerTest.java      |  8 +--
 .../bloomfilter/IndexProducerTest.java             |  4 +-
 .../bloomfilter/SetOperationsTest.java             | 80 +++++++++++-----------
 .../bloomfilter/SimpleBloomFilterTest.java         |  6 +-
 .../collections4/bloomfilter/TestingHashers.java   | 10 +--
 .../collection/CompositeCollectionTest.java        |  2 +
 .../collection/PredicatedCollectionTest.java       |  2 +-
 .../collections4/list/PredicatedListTest.java      |  2 +-
 .../collections4/map/PredicatedMapTest.java        |  2 +-
 .../collections4/map/PredicatedSortedMapTest.java  |  2 +-
 .../multiset/PredicatedMultiSetTest.java           |  2 +-
 .../collections4/queue/PredicatedQueueTest.java    |  2 +-
 .../collections4/set/PredicatedSetTest.java        |  2 +-
 34 files changed, 145 insertions(+), 151 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java
 
b/src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java
index 5fa0296f8..b06f2c4d4 100644
--- 
a/src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java
+++ 
b/src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java
@@ -272,10 +272,10 @@ public final class ArrayCountingBloomFilter implements 
CountingBloomFilter {
     }
 
     @Override
-    public int getMaxInsert(CellProducer cellProducer) {
-        int[] max = {Integer.MAX_VALUE};
+    public int getMaxInsert(final CellProducer cellProducer) {
+        final int[] max = {Integer.MAX_VALUE};
         cellProducer.forEachCell( (x, y) -> {
-            int count = cells[x] / y;
+            final int count = cells[x] / y;
             if (count < max[0]) {
                 max[0] = count;
             }
diff --git 
a/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java 
b/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java
index e4783bf3e..fbfbb91c4 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java
@@ -231,14 +231,14 @@ public interface BloomFilter extends IndexProducer, 
BitMapProducer {
      * @see Shape
      */
     default int estimateN() {
-        double d = getShape().estimateN(cardinality());
+        final double d = getShape().estimateN(cardinality());
         if (Double.isInfinite(d)) {
             return Integer.MAX_VALUE;
         }
         if (Double.isNaN(d)) {
             throw new IllegalArgumentException("Cardinality too large: " + 
cardinality());
         }
-        long l = Math.round(d);
+        final long l = Math.round(d);
         return l > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) l;
     }
 
@@ -283,8 +283,8 @@ public interface BloomFilter extends IndexProducer, 
BitMapProducer {
      */
     default int estimateIntersection(final BloomFilter other) {
         Objects.requireNonNull(other, "other");
-        double eThis = getShape().estimateN(cardinality());
-        double eOther = getShape().estimateN(other.cardinality());
+        final double eThis = getShape().estimateN(cardinality());
+        final double eOther = getShape().estimateN(other.cardinality());
         if (Double.isInfinite(eThis) && Double.isInfinite(eOther)) {
             // if both are infinite the union is infinite and we return 
Integer.MAX_VALUE
             return Integer.MAX_VALUE;
@@ -296,9 +296,9 @@ public interface BloomFilter extends IndexProducer, 
BitMapProducer {
         } else if (Double.isInfinite(eOther)) {
             estimate = Math.round(eThis);
         } else {
-            BloomFilter union = this.copy();
+            final BloomFilter union = this.copy();
             union.merge(other);
-            double eUnion = getShape().estimateN(union.cardinality());
+            final double eUnion = getShape().estimateN(union.cardinality());
             if (Double.isInfinite(eUnion)) {
                 throw new IllegalArgumentException("The estimated N for the 
union of the filters is infinite");
             }
diff --git 
a/src/main/java/org/apache/commons/collections4/bloomfilter/CellProducer.java 
b/src/main/java/org/apache/commons/collections4/bloomfilter/CellProducer.java
index 6949a13c6..ecb984e2c 100644
--- 
a/src/main/java/org/apache/commons/collections4/bloomfilter/CellProducer.java
+++ 
b/src/main/java/org/apache/commons/collections4/bloomfilter/CellProducer.java
@@ -95,8 +95,8 @@ public interface CellProducer extends IndexProducer {
             private void populate() {
                 if (counterCells.isEmpty()) {
                     producer.forEachIndex( idx -> {
-                        CounterCell cell = new CounterCell(idx, 1);
-                        CounterCell counter = counterCells.get(cell);
+                        final CounterCell cell = new CounterCell(idx, 1);
+                        final CounterCell counter = counterCells.get(cell);
                         if (counter == null) {
                             counterCells.put(cell, cell);
                         } else {
@@ -114,9 +114,9 @@ public interface CellProducer extends IndexProducer {
             }
 
             @Override
-            public boolean forEachCell(CellConsumer consumer) {
+            public boolean forEachCell(final CellConsumer consumer) {
                 populate();
-                for (CounterCell cell : counterCells.values()) {
+                for (final CounterCell cell : counterCells.values()) {
                     if (!consumer.test(cell.idx, cell.count)) {
                         return false;
                     }
@@ -131,13 +131,13 @@ public interface CellProducer extends IndexProducer {
                 final int idx;
                 int count;
 
-                CounterCell(int idx, int count) {
+                CounterCell(final int idx, final int count) {
                     this.idx = idx;
                     this.count = count;
                 }
 
                 @Override
-                public int compareTo(CounterCell other) {
+                public int compareTo(final CounterCell other) {
                     return Integer.compare(idx, other.idx);
                 }
             }
diff --git 
a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java
 
b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java
index 7c9310f40..a0ee54653 100644
--- 
a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java
+++ 
b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java
@@ -91,7 +91,7 @@ public interface CountingBloomFilter extends BloomFilter, 
CellProducer {
      * @param bloomFilter the Bloom filter the check for.
      * @return the maximum number of times the Bloom filter could have been 
inserted.
      */
-    default int getMaxInsert(BloomFilter bloomFilter) {
+    default int getMaxInsert(final BloomFilter bloomFilter) {
         return getMaxInsert((BitMapProducer) bloomFilter);
     }
 
@@ -104,7 +104,7 @@ public interface CountingBloomFilter extends BloomFilter, 
CellProducer {
      * @return the maximum number of times the IndexProducer could have been 
inserted.
      * @see #getMaxInsert(CellProducer)
      */
-    default int getMaxInsert(IndexProducer idxProducer) {
+    default int getMaxInsert(final IndexProducer idxProducer) {
         return getMaxInsert(CellProducer.from(idxProducer.uniqueIndices()) );
     }
 
@@ -121,7 +121,7 @@ public interface CountingBloomFilter extends BloomFilter, 
CellProducer {
      * @param hasher the Hasher to provide the indices.
      * @return the maximum number of times the hasher could have been inserted.
      */
-    default int getMaxInsert(Hasher hasher) {
+    default int getMaxInsert(final Hasher hasher) {
         return getMaxInsert(hasher.indices(getShape()));
     }
 
@@ -131,12 +131,12 @@ public interface CountingBloomFilter extends BloomFilter, 
CellProducer {
      * @param bitMapProducer the BitMapProducer to provide the indices.
      * @return the maximum number of times the BitMapProducer could have been 
inserted.
      */
-    default int getMaxInsert(BitMapProducer bitMapProducer) {
+    default int getMaxInsert(final BitMapProducer bitMapProducer) {
         if (!contains(bitMapProducer)) {
             return 0;
         }
-        long[] bitMaps = bitMapProducer.asBitMapArray();
-        int[] max = { Integer.MAX_VALUE };
+        final long[] bitMaps = bitMapProducer.asBitMapArray();
+        final int[] max = { Integer.MAX_VALUE };
         forEachCell((x, y) -> {
             if ((bitMaps[BitMap.getLongIndex(x)] & BitMap.getLongBit(x)) != 0) 
{
                 max[0] = max[0] <= y ? max[0] : y;
diff --git 
a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexProducer.java 
b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexProducer.java
index 0269d34ea..dd73a423d 100644
--- 
a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexProducer.java
+++ 
b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexProducer.java
@@ -131,7 +131,7 @@ public interface IndexProducer {
                 return size == data.length ? data : Arrays.copyOf(data, size);
             }
         }
-        Indices indices = new Indices();
+        final Indices indices = new Indices();
         forEachIndex(indices::add);
         return indices.toArray();
     }
@@ -158,7 +158,7 @@ public interface IndexProducer {
 
         return new IndexProducer() {
             @Override
-            public boolean forEachIndex(IntPredicate predicate) {
+            public boolean forEachIndex(final IntPredicate predicate) {
                 for (int idx = bitSet.nextSetBit(0); idx >= 0; idx = 
bitSet.nextSetBit(idx + 1)) {
                     if (!predicate.test(idx)) {
                         return false;
diff --git 
a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexUtils.java 
b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexUtils.java
index 96bfefec0..5cbf67785 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexUtils.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexUtils.java
@@ -38,7 +38,7 @@ final class IndexUtils {
      * @param index the index to add at.
      * @return the array or a newly allocated copy of the array.
      */
-    static int[] ensureCapacityForAdd(int[] array, int index) {
+    static int[] ensureCapacityForAdd(final int[] array, final int index) {
         if (index >= array.length) {
             return Arrays.copyOf(array, (int) 
Math.min(IndexUtils.MAX_ARRAY_SIZE, Math.max(array.length * 2L, index + 1)));
         }
diff --git a/src/test/java/org/apache/commons/collections4/BulkTest.java 
b/src/test/java/org/apache/commons/collections4/BulkTest.java
index c1b2be256..d34158443 100644
--- a/src/test/java/org/apache/commons/collections4/BulkTest.java
+++ b/src/test/java/org/apache/commons/collections4/BulkTest.java
@@ -155,7 +155,7 @@ public class BulkTest implements Cloneable {
     /**
      *  the name of the simple test method
      */
-    private String name;
+    private final String name;
 
     /**
      *  Constructs a new {@code BulkTest} instance that will run the
diff --git 
a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java 
b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
index 03d4fbe9d..f1e6a2f8e 100644
--- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
@@ -689,8 +689,7 @@ public class CollectionUtilsTest extends MockTestCase {
         assertEquals(2, CollectionUtils.get((Object) collectionA.iterator(), 
2));
         final Map<Integer, Integer> map = 
CollectionUtils.getCardinalityMap(collectionA);
         // Test assumes a defined iteration order so convert to a LinkedHashMap
-        final Map<Integer, Integer> linkedMap = new LinkedHashMap<>();
-        linkedMap.putAll(map);
+        final Map<Integer, Integer> linkedMap = new LinkedHashMap<>(map);
         assertEquals(linkedMap.entrySet().iterator().next(), 
CollectionUtils.get((Object) linkedMap, 0));
     }
 
diff --git a/src/test/java/org/apache/commons/collections4/ListUtilsTest.java 
b/src/test/java/org/apache/commons/collections4/ListUtilsTest.java
index 00d5f5821..328a1a087 100644
--- a/src/test/java/org/apache/commons/collections4/ListUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/ListUtilsTest.java
@@ -344,7 +344,7 @@ public class ListUtilsTest {
 
     @Test
     public void testPredicatedList() {
-        final Predicate<Object> predicate = o -> o instanceof String;
+        final Predicate<Object> predicate = String.class::isInstance;
         final List<Object> list = ListUtils.predicatedList(new ArrayList<>(), 
predicate);
         assertTrue(list instanceof PredicatedList, "returned object should be 
a PredicatedList");
         assertAll(
diff --git a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java 
b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
index b81539a38..2f8083aed 100644
--- a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
@@ -62,7 +62,7 @@ public class MapUtilsTest {
     private static final String TWO = "Two";
 
     public Predicate<Object> getPredicate() {
-        return o -> o instanceof String;
+        return String.class::isInstance;
     }
 
     @Test
diff --git a/src/test/java/org/apache/commons/collections4/SetUtilsTest.java 
b/src/test/java/org/apache/commons/collections4/SetUtilsTest.java
index 322615d64..47d6b3b9d 100644
--- a/src/test/java/org/apache/commons/collections4/SetUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/SetUtilsTest.java
@@ -208,7 +208,7 @@ public class SetUtilsTest {
 
     @Test
     public void testpredicatedSet() {
-        final Predicate<Object> predicate = o -> o instanceof String;
+        final Predicate<Object> predicate = String.class::isInstance;
         final Set<Object> set = SetUtils.predicatedSet(new HashSet<>(), 
predicate);
         assertTrue(set instanceof PredicatedSet, "returned object should be a 
PredicatedSet");
         assertAll(
diff --git 
a/src/test/java/org/apache/commons/collections4/bag/PredicatedBagTest.java 
b/src/test/java/org/apache/commons/collections4/bag/PredicatedBagTest.java
index 6379f464f..eed7904b8 100644
--- a/src/test/java/org/apache/commons/collections4/bag/PredicatedBagTest.java
+++ b/src/test/java/org/apache/commons/collections4/bag/PredicatedBagTest.java
@@ -41,7 +41,7 @@ public class PredicatedBagTest<T> extends AbstractBagTest<T> {
     }
 
     protected Predicate<T> stringPredicate() {
-        return o -> o instanceof String;
+        return String.class::isInstance;
     }
 
     protected Predicate<T> truePredicate = TruePredicate.<T>truePredicate();
diff --git 
a/src/test/java/org/apache/commons/collections4/bag/PredicatedSortedBagTest.java
 
b/src/test/java/org/apache/commons/collections4/bag/PredicatedSortedBagTest.java
index 5d3b7cb56..d15e84c61 100644
--- 
a/src/test/java/org/apache/commons/collections4/bag/PredicatedSortedBagTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/bag/PredicatedSortedBagTest.java
@@ -42,7 +42,7 @@ public class PredicatedSortedBagTest<T> extends 
AbstractSortedBagTest<T> {
     }
 
     protected Predicate<T> stringPredicate() {
-        return o -> o instanceof String;
+        return String.class::isInstance;
     }
 
     protected Predicate<T> truePredicate = TruePredicate.<T>truePredicate();
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBitMapProducerTest.java
 
b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBitMapProducerTest.java
index ec3832b75..8ae739c7d 100644
--- 
a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBitMapProducerTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBitMapProducerTest.java
@@ -106,14 +106,12 @@ public abstract class AbstractBitMapProducerTest {
 
         // test where the created producer does not process all records 
because the predicate function
         // returns false before the processing is completed.
-        int[] limit = new int[1];
+        final int[] limit = new int[1];
         final LongBiPredicate shortFunc =  (x, y) -> {
             limit[0]++;
             return limit[0] < 2;
         };
-        final BitMapProducer shortProducer = l -> {
-            return true;
-        };
+        final BitMapProducer shortProducer = l -> true;
         assertFalse(createProducer().forEachBitMapPair(shortProducer, 
shortFunc));
     }
 
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java
 
b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java
index e4a908277..3d332146d 100644
--- 
a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java
@@ -119,7 +119,7 @@ public abstract class AbstractBloomFilterTest<T extends 
BloomFilter> {
 
     @Test
     public void testMergeWithBitMapProducer() {
-        int bitMapCount = 
BitMap.numberOfBitMaps(getTestShape().getNumberOfBits());
+        final int bitMapCount = 
BitMap.numberOfBitMaps(getTestShape().getNumberOfBits());
         for (int i = 0; i < 5; i++) {
             final long[] values = new long[bitMapCount];
             for (final int idx : 
DefaultIndexProducerTest.generateIntArray(getTestShape().getNumberOfHashFunctions(),
 getTestShape().getNumberOfBits())) {
@@ -134,7 +134,7 @@ public abstract class AbstractBloomFilterTest<T extends 
BloomFilter> {
             assertTrue(lst.isEmpty());
         }
         // values too large
-        long[] values = new long[bitMapCount];
+        final long[] values = new long[bitMapCount];
         Arrays.fill(values, Long.MAX_VALUE);
         final BitMapProducer badProducer = 
BitMapProducer.fromBitMapArray(values);
         final BloomFilter bf = createEmptyFilter(getTestShape());
@@ -162,11 +162,11 @@ public abstract class AbstractBloomFilterTest<T extends 
BloomFilter> {
         // value to large
         final BloomFilter f1 = createEmptyFilter(getTestShape());
         assertThrows(IllegalArgumentException.class,
-                () -> f1.merge(IndexProducer.fromIndexArray(new int[] 
{getTestShape().getNumberOfBits()})));
+                () -> 
f1.merge(IndexProducer.fromIndexArray(getTestShape().getNumberOfBits())));
         // negative value
         final BloomFilter f2 = createEmptyFilter(getTestShape());
         assertThrows(IllegalArgumentException.class,
-                () -> f2.merge(IndexProducer.fromIndexArray(new int[] {-1})));
+                () -> f2.merge(IndexProducer.fromIndexArray(-1)));
     }
 
     @Test
@@ -218,12 +218,12 @@ public abstract class AbstractBloomFilterTest<T extends 
BloomFilter> {
 
     @Test
     public final void testNegativeIntersection() {
-        IndexProducer p1 = IndexProducer.fromIndexArray(0, 1, 2, 3, 4, 5, 6, 
7, 8, 9, 10, 11, 12, 13, 20, 26, 28, 30, 32, 34, 35, 36, 37, 39, 40, 41, 42, 
43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 
65, 66, 67, 68, 69, 70, 71);
-        IndexProducer p2 = IndexProducer.fromIndexArray(1, 2, 3, 4, 5, 6, 7, 
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27);
+        final IndexProducer p1 = IndexProducer.fromIndexArray(0, 1, 2, 3, 4, 
5, 6, 7, 8, 9, 10, 11, 12, 13, 20, 26, 28, 30, 32, 34, 35, 36, 37, 39, 40, 41, 
42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 
64, 65, 66, 67, 68, 69, 70, 71);
+        final IndexProducer p2 = IndexProducer.fromIndexArray(1, 2, 3, 4, 5, 
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 
27);
 
-        BloomFilter filter1 = createEmptyFilter(Shape.fromKM(17, 72));
+        final BloomFilter filter1 = createEmptyFilter(Shape.fromKM(17, 72));
         filter1.merge(p1);
-        BloomFilter filter2 = createEmptyFilter(Shape.fromKM(17, 72));
+        final BloomFilter filter2 = createEmptyFilter(Shape.fromKM(17, 72));
         filter2.merge(p2);
         assertEquals(0, filter1.estimateIntersection(filter2));
     }
@@ -249,9 +249,9 @@ public abstract class AbstractBloomFilterTest<T extends 
BloomFilter> {
         assertEquals(0, bf.estimateIntersection(bf4));
         assertEquals(0, bf4.estimateIntersection(bf));
 
-        int midPoint = getTestShape().getNumberOfBits() / 2;
-        BloomFilter bf5 = 
TestingHashers.populateRange(createEmptyFilter(getTestShape()), 0, midPoint);
-        BloomFilter bf6 = 
TestingHashers.populateRange(createEmptyFilter(getTestShape()), midPoint+1, 
getTestShape().getNumberOfBits()-1);
+        final int midPoint = getTestShape().getNumberOfBits() / 2;
+        final BloomFilter bf5 = 
TestingHashers.populateRange(createEmptyFilter(getTestShape()), 0, midPoint);
+        final BloomFilter bf6 = 
TestingHashers.populateRange(createEmptyFilter(getTestShape()), midPoint+1, 
getTestShape().getNumberOfBits()-1);
         assertThrows(IllegalArgumentException.class, () -> 
bf5.estimateIntersection(bf6));
 
         // infinite with infinite
@@ -371,8 +371,8 @@ public abstract class AbstractBloomFilterTest<T extends 
BloomFilter> {
         assertThrows(IllegalArgumentException.class, () -> bf1.merge(new 
BadHasher(-1)));
 
         // test error when bloom filter returns values out of range
-        Shape s = Shape.fromKM(getTestShape().getNumberOfHashFunctions(), 
getTestShape().getNumberOfBits() * 3);
-        Hasher h = new IncrementingHasher(getTestShape().getNumberOfBits() * 
2, 1);
+        final Shape s = 
Shape.fromKM(getTestShape().getNumberOfHashFunctions(), 
getTestShape().getNumberOfBits() * 3);
+        final Hasher h = new 
IncrementingHasher(getTestShape().getNumberOfBits() * 2, 1);
         final BloomFilter bf5 = new SimpleBloomFilter(s);
         bf5.merge(h);
         assertThrows(IllegalArgumentException.class, () -> bf1.merge(bf5));
@@ -441,7 +441,7 @@ public abstract class AbstractBloomFilterTest<T extends 
BloomFilter> {
         IndexProducer producer;
 
         public BadHasher(final int value) {
-            this.producer = IndexProducer.fromIndexArray(new int[] {value});
+            this.producer = IndexProducer.fromIndexArray(value);
         }
 
         @Override
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractCellProducerTest.java
 
b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractCellProducerTest.java
index 6591d14e4..68dcbb6b1 100644
--- 
a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractCellProducerTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractCellProducerTest.java
@@ -106,10 +106,10 @@ public abstract class AbstractCellProducerTest extends 
AbstractIndexProducerTest
 
     @Test
     public void testForEachCellValues() {
-        int[] expectedIdx = getExpectedIndices();
-        int[] expectedValue = getExpectedValues();
+        final int[] expectedIdx = getExpectedIndices();
+        final int[] expectedValue = getExpectedValues();
         assertEquals(expectedIdx.length, expectedValue.length, "expected index 
length and value length do not match");
-        int[] idx = {0};
+        final int[] idx = {0};
         createProducer().forEachCell((i, j) -> {
             assertEquals(expectedIdx[idx[0]], i, "bad index at " + idx[0]);
             assertEquals(expectedValue[idx[0]], j, "bad value at " + idx[0]);
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractCountingBloomFilterTest.java
 
b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractCountingBloomFilterTest.java
index 6d489d8d1..6bc6b1bdd 100644
--- 
a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractCountingBloomFilterTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractCountingBloomFilterTest.java
@@ -39,7 +39,7 @@ public abstract class AbstractCountingBloomFilterTest<T 
extends CountingBloomFil
 
     private static final long bigHashValue = 0xffffffeL;
 
-    protected final CellProducer getMaximumValueProducer(int maxValue) {
+    protected final CellProducer getMaximumValueProducer(final int maxValue) {
         return consumer -> {
             for (int i = 1; i < 18; i++) {
                 if (!consumer.test(i, maxValue)) {
@@ -194,7 +194,7 @@ public abstract class AbstractCountingBloomFilterTest<T 
extends CountingBloomFil
         assertCounts(bf3, new int[] {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0});
 
         assertThrows(IllegalArgumentException.class, () -> bf3.remove( new 
BadHasher(-1)));
-        assertThrows(IllegalArgumentException.class, () -> bf3.remove( new 
BadHasher(getTestShape().getNumberOfBits())));;
+        assertThrows(IllegalArgumentException.class, () -> bf3.remove( new 
BadHasher(getTestShape().getNumberOfBits())));
     }
 
     /**
@@ -266,7 +266,7 @@ public abstract class AbstractCountingBloomFilterTest<T 
extends CountingBloomFil
         final BitMapProducer bmp2 = BitMapProducer.fromIndexProducer(ip2, 
getTestShape().getNumberOfBits());
         assertThrows(IllegalArgumentException.class, () -> bf7.remove(bmp2));
         assertThrows(IllegalArgumentException.class, () -> bf7.remove( new 
BadHasher(-1)));
-        assertThrows(IllegalArgumentException.class, () -> bf7.remove( new 
BadHasher(getTestShape().getNumberOfBits())));;
+        assertThrows(IllegalArgumentException.class, () -> bf7.remove( new 
BadHasher(getTestShape().getNumberOfBits())));
     }
 
     @Test
@@ -299,12 +299,12 @@ public abstract class AbstractCountingBloomFilterTest<T 
extends CountingBloomFil
         assertTrue(bf1.forEachCell((x, y) -> false), "Hasher in removes 
results in value not equal to 0");
     }
 
-    private void verifyMaxInsert(CountingBloomFilter bf, int from1, int 
from11) {
-        BloomFilter bfFrom0 = new 
DefaultBloomFilterTest.SparseDefaultBloomFilter(getTestShape());
+    private void verifyMaxInsert(final CountingBloomFilter bf, final int 
from1, final int from11) {
+        final BloomFilter bfFrom0 = new 
DefaultBloomFilterTest.SparseDefaultBloomFilter(getTestShape());
         bfFrom0.merge(new IncrementingHasher(0, 1));
-        BloomFilter bfFrom1 = new 
DefaultBloomFilterTest.SparseDefaultBloomFilter(getTestShape());
+        final BloomFilter bfFrom1 = new 
DefaultBloomFilterTest.SparseDefaultBloomFilter(getTestShape());
         bfFrom1.merge(TestingHashers.FROM1);
-        BloomFilter bfFrom11 = new 
DefaultBloomFilterTest.SparseDefaultBloomFilter(getTestShape());
+        final BloomFilter bfFrom11 = new 
DefaultBloomFilterTest.SparseDefaultBloomFilter(getTestShape());
         bfFrom11.merge(TestingHashers.FROM11);
 
         assertEquals(0, bf.getMaxInsert(new IncrementingHasher(0, 1)));
@@ -325,7 +325,7 @@ public abstract class AbstractCountingBloomFilterTest<T 
extends CountingBloomFil
 
     @Test
     public void testGetMaxInsert() {
-        CountingBloomFilter bf = createEmptyFilter(getTestShape());
+        final CountingBloomFilter bf = createEmptyFilter(getTestShape());
         verifyMaxInsert(bf, 0, 0);
         bf.merge(TestingHashers.FROM1);
         verifyMaxInsert(bf, 1, 0);
@@ -343,7 +343,7 @@ public abstract class AbstractCountingBloomFilterTest<T 
extends CountingBloomFil
         assertEquals(0, bf.getMaxInsert(new IncrementingHasher(5, 1)));
     }
 
-    private void assertCell3(CountingBloomFilter bf, int value) {
+    private void assertCell3(final CountingBloomFilter bf, final int value) {
         bf.forEachCell((k, v) -> {
             if (k == 3) {
                 assertEquals(value, v, "Mismatch at position 3");
@@ -356,11 +356,11 @@ public abstract class AbstractCountingBloomFilterTest<T 
extends CountingBloomFil
 
     @Test
     public void mergeIncrementsAllCellsTest() {
-        CountingBloomFilter f1 = createEmptyFilter(Shape.fromKM(1, 10));
-        CountingBloomFilter f2 = f1.copy();
-        CountingBloomFilter f3 = f1.copy();
+        final CountingBloomFilter f1 = createEmptyFilter(Shape.fromKM(1, 10));
+        final CountingBloomFilter f2 = f1.copy();
+        final CountingBloomFilter f3 = f1.copy();
         // index producer produces 3 two times.
-        IndexProducer ip = p -> {
+        final IndexProducer ip = p -> {
             p.test(3);
             p.test(3);
             return true;
@@ -376,16 +376,16 @@ public abstract class AbstractCountingBloomFilterTest<T 
extends CountingBloomFil
 
     @Test
     public void removeDecrementsAllCellsTest() {
-        CountingBloomFilter f1 = createEmptyFilter(Shape.fromKM(1, 10));
-        CellProducer cp = p -> {
+        final CountingBloomFilter f1 = createEmptyFilter(Shape.fromKM(1, 10));
+        final CellProducer cp = p -> {
             p.test(3, 3);
             return true;
         };
         f1.add(cp);
-        CountingBloomFilter f2 = f1.copy();
-        CountingBloomFilter f3 = f1.copy();
+        final CountingBloomFilter f2 = f1.copy();
+        final CountingBloomFilter f3 = f1.copy();
         // index producer produces 3 two times.
-        IndexProducer ip = p -> {
+        final IndexProducer ip = p -> {
             p.test(3);
             p.test(3);
             return true;
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractIndexProducerTest.java
 
b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractIndexProducerTest.java
index 868982d2a..faa66ead7 100644
--- 
a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractIndexProducerTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractIndexProducerTest.java
@@ -249,7 +249,7 @@ public abstract class AbstractIndexProducerTest {
 
     @Test
     public void testUniqueReturnsSelf() {
-        IndexProducer expected = createProducer().uniqueIndices();
+        final IndexProducer expected = createProducer().uniqueIndices();
         assertSame(expected, expected.uniqueIndices());
     }
 }
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/BitMapTest.java 
b/src/test/java/org/apache/commons/collections4/bloomfilter/BitMapTest.java
index 00d5df451..5c58ca345 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/BitMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/BitMapTest.java
@@ -128,7 +128,7 @@ public class BitMapTest {
      * @param dividend the dividend
      * @param divisor the divisor
      */
-    private void assertMod(long dividend, int divisor) {
+    private void assertMod(final long dividend, final int divisor) {
         assertTrue(divisor > 0 && divisor <= Integer.MAX_VALUE,
             "Incorrect usage. Divisor must be strictly positive.");
         assertEquals((int) Long.remainderUnsigned(dividend, divisor), 
BitMap.mod(dividend, divisor),
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/DefaultBitMapProducerTest.java
 
b/src/test/java/org/apache/commons/collections4/bloomfilter/DefaultBitMapProducerTest.java
index d0bee54c7..cc8cfdf74 100644
--- 
a/src/test/java/org/apache/commons/collections4/bloomfilter/DefaultBitMapProducerTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/bloomfilter/DefaultBitMapProducerTest.java
@@ -91,16 +91,13 @@ public class DefaultBitMapProducerTest extends 
AbstractBitMapProducerTest {
     @Test
     public void testAsBitMapArrayLargeArray() {
         final long[] expected = generateLongArray(32);
-        BitMapProducer producer = new BitMapProducer() {
-            @Override
-            public boolean forEachBitMap(LongPredicate predicate) {
-                for (long l : expected) {
-                    if (!predicate.test(l)) {
-                        return false;
-                    }
+        final BitMapProducer producer = predicate -> {
+            for (final long l : expected) {
+                if (!predicate.test(l)) {
+                    return false;
                 }
-                return true;
             }
+            return true;
         };
         final long[] ary = producer.asBitMapArray();
         assertArrayEquals(expected, ary);
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/DefaultBloomFilterTest.java
 
b/src/test/java/org/apache/commons/collections4/bloomfilter/DefaultBloomFilterTest.java
index 302bee7ad..e716c42b5 100644
--- 
a/src/test/java/org/apache/commons/collections4/bloomfilter/DefaultBloomFilterTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/bloomfilter/DefaultBloomFilterTest.java
@@ -71,15 +71,15 @@ public class DefaultBloomFilterTest extends 
AbstractBloomFilterTest<DefaultBloom
     @Test
     public void testEstimateNWithBrokenCardinality() {
         // build a filter
-        BloomFilter filter1 = TestingHashers.populateEntireFilter(new 
BrokenCardinality(getTestShape()));
+        final BloomFilter filter1 = TestingHashers.populateEntireFilter(new 
BrokenCardinality(getTestShape()));
         assertThrows(IllegalArgumentException.class, () -> 
filter1.estimateN());
     }
 
     @Test
     public void testEstimateLargeN() {
-        Shape s = Shape.fromKM(1, Integer.MAX_VALUE);
+        final Shape s = Shape.fromKM(1, Integer.MAX_VALUE);
         // create a very large filter with Integer.MAX_VALUE-1 bits set.
-        BloomFilter bf1 = new SimpleBloomFilter(s);
+        final BloomFilter bf1 = new SimpleBloomFilter(s);
         bf1.merge((BitMapProducer) predicate -> {
             int limit = Integer.MAX_VALUE - 1;
             while (limit > 64) {
@@ -100,9 +100,9 @@ public class DefaultBloomFilterTest extends 
AbstractBloomFilterTest<DefaultBloom
 
     @Test
     public void testIntersectionLimit() {
-        Shape s = Shape.fromKM(1, Integer.MAX_VALUE);
+        final Shape s = Shape.fromKM(1, Integer.MAX_VALUE);
         // create a very large filter with Integer.MAX_VALUE-1 bit set.
-        BloomFilter bf1 = new SimpleBloomFilter(s);
+        final BloomFilter bf1 = new SimpleBloomFilter(s);
         bf1.merge((BitMapProducer) predicate -> {
             int limit = Integer.MAX_VALUE - 1;
             while (limit > 64) {
@@ -122,9 +122,9 @@ public class DefaultBloomFilterTest extends 
AbstractBloomFilterTest<DefaultBloom
 
     @Test
     public void testSparseNonSparseMerging() {
-        BloomFilter bf1 = new SparseDefaultBloomFilter(getTestShape());
+        final BloomFilter bf1 = new SparseDefaultBloomFilter(getTestShape());
         bf1.merge(TestingHashers.FROM1);
-        BloomFilter bf2 = new NonSparseDefaultBloomFilter(getTestShape());
+        final BloomFilter bf2 = new 
NonSparseDefaultBloomFilter(getTestShape());
         bf2.merge(TestingHashers.FROM11);
 
         BloomFilter result = bf1.copy();
@@ -255,7 +255,7 @@ public class DefaultBloomFilterTest extends 
AbstractBloomFilterTest<DefaultBloom
 
     static class BrokenCardinality extends NonSparseDefaultBloomFilter {
 
-        BrokenCardinality(Shape shape) {
+        BrokenCardinality(final Shape shape) {
             super(shape);
         }
 
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/DefaultIndexProducerTest.java
 
b/src/test/java/org/apache/commons/collections4/bloomfilter/DefaultIndexProducerTest.java
index 73a3a58dc..382321355 100644
--- 
a/src/test/java/org/apache/commons/collections4/bloomfilter/DefaultIndexProducerTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/bloomfilter/DefaultIndexProducerTest.java
@@ -124,9 +124,9 @@ public class DefaultIndexProducerTest extends 
AbstractIndexProducerTest {
 
     @ParameterizedTest
     @ValueSource(ints = {32, 33})
-    public void testEntries(int size) {
-        int[] values = IntStream.range(0, size).toArray();
-        IndexProducer producer =  predicate -> {
+    public void testEntries(final int size) {
+        final int[] values = IntStream.range(0, size).toArray();
+        final IndexProducer producer =  predicate -> {
             Objects.requireNonNull(predicate);
             for (final int i : values) {
                 if (!predicate.test(i)) {
@@ -135,7 +135,7 @@ public class DefaultIndexProducerTest extends 
AbstractIndexProducerTest {
             }
             return true;
         };
-        int[] other = producer.asIndexArray();
+        final int[] other = producer.asIndexArray();
         assertArrayEquals(values, other);
     }
 }
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/IndexProducerTest.java
 
b/src/test/java/org/apache/commons/collections4/bloomfilter/IndexProducerTest.java
index 655dfeed9..9cf4bcc37 100644
--- 
a/src/test/java/org/apache/commons/collections4/bloomfilter/IndexProducerTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/bloomfilter/IndexProducerTest.java
@@ -74,8 +74,8 @@ public class IndexProducerTest {
 
     @ParameterizedTest
     @ValueSource(ints = {32, 33})
-    void testAsIndexArray(int n) {
-        IndexProducer ip = i -> {
+    void testAsIndexArray(final int n) {
+        final IndexProducer ip = i -> {
             for (int j = 0; j < n; j++) {
                 // Always test index zero
                 i.test(0);
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/SetOperationsTest.java
 
b/src/test/java/org/apache/commons/collections4/bloomfilter/SetOperationsTest.java
index 792917bc1..94acad15d 100644
--- 
a/src/test/java/org/apache/commons/collections4/bloomfilter/SetOperationsTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/bloomfilter/SetOperationsTest.java
@@ -208,16 +208,16 @@ public class SetOperationsTest {
     @Test
     public final void testOrCardinality() {
         final Shape shape = Shape.fromKM(3, 128);
-        BloomFilter filter1 = createFilter(shape, 
IndexProducer.fromIndexArray(new int[] {1, 63, 64}));
-        BloomFilter filter2 = createFilter(shape, 
IndexProducer.fromIndexArray(new int[] {5, 64, 69}));
+        BloomFilter filter1 = createFilter(shape, 
IndexProducer.fromIndexArray(1, 63, 64));
+        BloomFilter filter2 = createFilter(shape, 
IndexProducer.fromIndexArray(5, 64, 69));
         assertSymmetricOperation(5, SetOperations::orCardinality, filter1, 
filter2);
 
-        filter1 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{1, 63}));
-        filter2 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 64, 69}));
+        filter1 = createFilter(shape, IndexProducer.fromIndexArray(1, 63));
+        filter2 = createFilter(shape, IndexProducer.fromIndexArray(5, 64, 69));
         assertSymmetricOperation(5, SetOperations::orCardinality, filter1, 
filter2);
 
-        filter1 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 63}));
-        filter2 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 64, 69}));
+        filter1 = createFilter(shape, IndexProducer.fromIndexArray(5, 63));
+        filter2 = createFilter(shape, IndexProducer.fromIndexArray(5, 64, 69));
         assertSymmetricOperation(4, SetOperations::orCardinality, filter1, 
filter2);
     }
 
@@ -225,32 +225,32 @@ public class SetOperationsTest {
     public final void testOrCardinalityWithDifferentLengthFilters() {
         final Shape shape = Shape.fromKM(3, 128);
         final Shape shape2 = Shape.fromKM(3, 192);
-        BloomFilter filter1 = createFilter(shape, 
IndexProducer.fromIndexArray(new int[] {1, 63, 64}));
-        BloomFilter filter2 = createFilter(shape2, 
IndexProducer.fromIndexArray(new int[] {5, 64, 169}));
+        BloomFilter filter1 = createFilter(shape, 
IndexProducer.fromIndexArray(1, 63, 64));
+        BloomFilter filter2 = createFilter(shape2, 
IndexProducer.fromIndexArray(5, 64, 169));
         assertSymmetricOperation(5, SetOperations::orCardinality, filter1, 
filter2);
 
-        filter1 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{1, 63}));
-        filter2 = createFilter(shape2, IndexProducer.fromIndexArray(new int[] 
{5, 64, 169}));
+        filter1 = createFilter(shape, IndexProducer.fromIndexArray(1, 63));
+        filter2 = createFilter(shape2, IndexProducer.fromIndexArray(5, 64, 
169));
         assertSymmetricOperation(5, SetOperations::orCardinality, filter1, 
filter2);
 
-        filter1 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 63}));
-        filter2 = createFilter(shape2, IndexProducer.fromIndexArray(new int[] 
{5, 64, 169}));
+        filter1 = createFilter(shape, IndexProducer.fromIndexArray(5, 63));
+        filter2 = createFilter(shape2, IndexProducer.fromIndexArray(5, 64, 
169));
         assertSymmetricOperation(4, SetOperations::orCardinality, filter1, 
filter2);
     }
 
     @Test
     public final void testAndCardinality() {
         final Shape shape = Shape.fromKM(3, 128);
-        BloomFilter filter1 = createFilter(shape, 
IndexProducer.fromIndexArray(new int[] {1, 63, 64}));
-        BloomFilter filter2 = createFilter(shape, 
IndexProducer.fromIndexArray(new int[] {5, 64, 69}));
+        BloomFilter filter1 = createFilter(shape, 
IndexProducer.fromIndexArray(1, 63, 64));
+        BloomFilter filter2 = createFilter(shape, 
IndexProducer.fromIndexArray(5, 64, 69));
         assertSymmetricOperation(1, SetOperations::andCardinality, filter1, 
filter2);
 
-        filter1 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{1, 63}));
-        filter2 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 64, 69}));
+        filter1 = createFilter(shape, IndexProducer.fromIndexArray(1, 63));
+        filter2 = createFilter(shape, IndexProducer.fromIndexArray(5, 64, 69));
         assertSymmetricOperation(0, SetOperations::andCardinality, filter1, 
filter2);
 
-        filter1 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 63}));
-        filter2 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 64, 69}));
+        filter1 = createFilter(shape, IndexProducer.fromIndexArray(5, 63));
+        filter2 = createFilter(shape, IndexProducer.fromIndexArray(5, 64, 69));
         assertSymmetricOperation(1, SetOperations::andCardinality, filter1, 
filter2);
     }
 
@@ -258,37 +258,37 @@ public class SetOperationsTest {
     public final void testAndCardinalityWithDifferentLengthFilters() {
         final Shape shape = Shape.fromKM(3, 128);
         final Shape shape2 = Shape.fromKM(3, 192);
-        BloomFilter filter1 = createFilter(shape, 
IndexProducer.fromIndexArray(new int[] {1, 63, 64}));
-        BloomFilter filter2 = createFilter(shape2, 
IndexProducer.fromIndexArray(new int[] {5, 64, 169}));
+        BloomFilter filter1 = createFilter(shape, 
IndexProducer.fromIndexArray(1, 63, 64));
+        BloomFilter filter2 = createFilter(shape2, 
IndexProducer.fromIndexArray(5, 64, 169));
         assertSymmetricOperation(1, SetOperations::andCardinality, filter1, 
filter2);
 
-        filter1 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{1, 63}));
-        filter2 = createFilter(shape2, IndexProducer.fromIndexArray(new int[] 
{5, 64, 169}));
+        filter1 = createFilter(shape, IndexProducer.fromIndexArray(1, 63));
+        filter2 = createFilter(shape2, IndexProducer.fromIndexArray(5, 64, 
169));
         assertSymmetricOperation(0, SetOperations::andCardinality, filter1, 
filter2);
 
-        filter1 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 63}));
-        filter2 = createFilter(shape2, IndexProducer.fromIndexArray(new int[] 
{5, 64, 169}));
+        filter1 = createFilter(shape, IndexProducer.fromIndexArray(5, 63));
+        filter2 = createFilter(shape2, IndexProducer.fromIndexArray(5, 64, 
169));
         assertSymmetricOperation(1, SetOperations::andCardinality, filter1, 
filter2);
     }
 
     @Test
     public final void testXorCardinality() {
         final Shape shape = Shape.fromKM(3, 128);
-        BloomFilter filter1 = createFilter(shape, 
IndexProducer.fromIndexArray(new int[] {1, 63, 64}));
-        BloomFilter filter2 = createFilter(shape, 
IndexProducer.fromIndexArray(new int[] {5, 64, 69}));
+        BloomFilter filter1 = createFilter(shape, 
IndexProducer.fromIndexArray(1, 63, 64));
+        BloomFilter filter2 = createFilter(shape, 
IndexProducer.fromIndexArray(5, 64, 69));
         assertSymmetricOperation(4, SetOperations::xorCardinality, filter1, 
filter2);
 
-        filter1 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{1, 63}));
-        filter2 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 64, 69}));
+        filter1 = createFilter(shape, IndexProducer.fromIndexArray(1, 63));
+        filter2 = createFilter(shape, IndexProducer.fromIndexArray(5, 64, 69));
         assertSymmetricOperation(5, SetOperations::xorCardinality, filter1, 
filter2);
 
-        filter1 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 63}));
-        filter2 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 64, 69}));
+        filter1 = createFilter(shape, IndexProducer.fromIndexArray(5, 63));
+        filter2 = createFilter(shape, IndexProducer.fromIndexArray(5, 64, 69));
         assertSymmetricOperation(3, SetOperations::xorCardinality, filter1, 
filter2);
 
         final Shape bigShape = Shape.fromKM(3, 192);
-        filter1 = createFilter(bigShape, IndexProducer.fromIndexArray(new 
int[] {1, 63, 185}));
-        filter2 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 63, 69}));
+        filter1 = createFilter(bigShape, IndexProducer.fromIndexArray(1, 63, 
185));
+        filter2 = createFilter(shape, IndexProducer.fromIndexArray(5, 63, 69));
         assertSymmetricOperation(4, SetOperations::xorCardinality, filter1, 
filter2);
     }
 
@@ -297,23 +297,23 @@ public class SetOperationsTest {
         final Shape shape = Shape.fromKM(3, 128);
         final Shape shape2 = Shape.fromKM(3, 192);
 
-        BloomFilter filter1 = createFilter(shape, 
IndexProducer.fromIndexArray(new int[] {1, 63, 64}));
-        BloomFilter filter2 = createFilter(shape2, 
IndexProducer.fromIndexArray(new int[] {5, 64, 169}));
+        BloomFilter filter1 = createFilter(shape, 
IndexProducer.fromIndexArray(1, 63, 64));
+        BloomFilter filter2 = createFilter(shape2, 
IndexProducer.fromIndexArray(5, 64, 169));
         assertSymmetricOperation(4, SetOperations::xorCardinality, filter1, 
filter2);
 
-        filter1 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{1, 63}));
-        filter2 = createFilter(shape2, IndexProducer.fromIndexArray(new int[] 
{5, 64, 169}));
+        filter1 = createFilter(shape, IndexProducer.fromIndexArray(1, 63));
+        filter2 = createFilter(shape2, IndexProducer.fromIndexArray(5, 64, 
169));
         assertSymmetricOperation(5, SetOperations::xorCardinality, filter1, 
filter2);
 
-        filter1 = createFilter(shape, IndexProducer.fromIndexArray(new int[] 
{5, 63}));
-        filter2 = createFilter(shape2, IndexProducer.fromIndexArray(new int[] 
{5, 64, 169}));
+        filter1 = createFilter(shape, IndexProducer.fromIndexArray(5, 63));
+        filter2 = createFilter(shape2, IndexProducer.fromIndexArray(5, 64, 
169));
         assertSymmetricOperation(3, SetOperations::xorCardinality, filter1, 
filter2);
     }
 
     @Test
     public final void testCommutativityOnMismatchedSizes() {
-        final BitMapProducer p1 = BitMapProducer.fromBitMapArray(new long[] 
{0x3L, 0x5L});
-        final BitMapProducer p2 = BitMapProducer.fromBitMapArray(new long[] 
{0x1L});
+        final BitMapProducer p1 = BitMapProducer.fromBitMapArray(0x3L, 0x5L);
+        final BitMapProducer p2 = BitMapProducer.fromBitMapArray(0x1L);
 
         assertEquals(SetOperations.orCardinality(p1, p2), 
SetOperations.orCardinality(p2, p1));
         assertEquals(SetOperations.xorCardinality(p1, p2), 
SetOperations.xorCardinality(p2, p1));
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/SimpleBloomFilterTest.java
 
b/src/test/java/org/apache/commons/collections4/bloomfilter/SimpleBloomFilterTest.java
index f58828afc..1552e9c76 100644
--- 
a/src/test/java/org/apache/commons/collections4/bloomfilter/SimpleBloomFilterTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/bloomfilter/SimpleBloomFilterTest.java
@@ -32,12 +32,10 @@ public class SimpleBloomFilterTest extends 
AbstractBloomFilterTest<SimpleBloomFi
 
     @Test
     public void testMergeShortBitMapProducer() {
-        SimpleBloomFilter filter = createEmptyFilter(getTestShape());
+        final SimpleBloomFilter filter = createEmptyFilter(getTestShape());
         // create a producer that returns too few values
         // shape expects 2 longs we are sending 1.
-        BitMapProducer producer = p -> {
-            return p.test(2L);
-        };
+        final BitMapProducer producer = p -> p.test(2L);
         assertTrue(filter.merge(producer));
         assertEquals(1, filter.cardinality());
     }
diff --git 
a/src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java 
b/src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java
index 84b17f554..c97d59c1f 100644
--- 
a/src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java
+++ 
b/src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java
@@ -42,8 +42,8 @@ public class TestingHashers {
      * @param hashers The hashers to merge
      * @return {@code filter} for chaining
      */
-    public static <T extends BloomFilter> T mergeHashers(T filter, 
Hasher...hashers) {
-        for (Hasher h : hashers) {
+    public static <T extends BloomFilter> T mergeHashers(final T filter, final 
Hasher...hashers) {
+        for (final Hasher h : hashers) {
             filter.merge(h);
         }
         return filter;
@@ -55,7 +55,7 @@ public class TestingHashers {
      * @param filter The Bloom filter to populate
      * @return {@code filter} for chaining
      */
-    public static <T extends BloomFilter> T 
populateFromHashersFrom1AndFrom11(T filter) {
+    public static <T extends BloomFilter> T 
populateFromHashersFrom1AndFrom11(final T filter) {
         return mergeHashers(filter, FROM1, FROM11);
     }
 
@@ -65,7 +65,7 @@ public class TestingHashers {
      * @param filter the Bloom filter to populate
      * @return {@code filter} for chaining
      */
-    public static <T extends BloomFilter> T populateEntireFilter(T filter) {
+    public static <T extends BloomFilter> T populateEntireFilter(final T 
filter) {
         return populateRange(filter, 0, filter.getShape().getNumberOfBits() - 
1);
     }
 
@@ -77,7 +77,7 @@ public class TestingHashers {
      * @param end the last bit to enable.
      * @return {@code filter} for chaining
      */
-    public static <T extends BloomFilter> T populateRange(T filter, int start, 
int end) {
+    public static <T extends BloomFilter> T populateRange(final T filter, 
final int start, final int end) {
         filter.merge((IndexProducer) p -> {
             for (int i = start; i <= end; i++) {
                 if (!p.test(i)) {
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 9bc394ca2..05d0830a2 100644
--- 
a/src/test/java/org/apache/commons/collections4/collection/CompositeCollectionTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/collection/CompositeCollectionTest.java
@@ -112,6 +112,8 @@ public class CompositeCollectionTest<E> extends 
AbstractCollectionTest<E> {
         setUpTest();
         c.setMutator(new CompositeCollection.CollectionMutator<E>() {
 
+            private static final long serialVersionUID = 1L;
+
             @Override
             public boolean add(final CompositeCollection<E> composite, final 
List<Collection<E>> collections, final E obj) {
                 for (final Collection<E> coll : collections) {
diff --git 
a/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionTest.java
 
b/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionTest.java
index b259237be..d42d12ea9 100644
--- 
a/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionTest.java
@@ -75,7 +75,7 @@ public class PredicatedCollectionTest<E> extends 
AbstractCollectionTest<E> {
     }
 
     protected Predicate<E> testPredicate =
-        o -> o instanceof String;
+        String.class::isInstance;
 
     public Collection<E> makeTestCollection() {
         return decorateCollection(new ArrayList<>(), testPredicate);
diff --git 
a/src/test/java/org/apache/commons/collections4/list/PredicatedListTest.java 
b/src/test/java/org/apache/commons/collections4/list/PredicatedListTest.java
index cc80cd366..80880d077 100644
--- a/src/test/java/org/apache/commons/collections4/list/PredicatedListTest.java
+++ b/src/test/java/org/apache/commons/collections4/list/PredicatedListTest.java
@@ -59,7 +59,7 @@ public class PredicatedListTest<E> extends 
AbstractListTest<E> {
     }
 
     protected Predicate<E> testPredicate =
-        o -> o instanceof String;
+        String.class::isInstance;
 
     public List<E> makeTestList() {
         return decorateList(new ArrayList<>(), testPredicate);
diff --git 
a/src/test/java/org/apache/commons/collections4/map/PredicatedMapTest.java 
b/src/test/java/org/apache/commons/collections4/map/PredicatedMapTest.java
index 1b9968b85..3ceed1f2a 100644
--- a/src/test/java/org/apache/commons/collections4/map/PredicatedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/PredicatedMapTest.java
@@ -40,7 +40,7 @@ public class PredicatedMapTest<K, V> extends 
AbstractIterableMapTest<K, V> {
 
     protected static final Predicate<Object> truePredicate = 
TruePredicate.<Object>truePredicate();
 
-    protected static final Predicate<Object> testPredicate = o -> o instanceof 
String;
+    protected static final Predicate<Object> testPredicate = 
String.class::isInstance;
 
     public PredicatedMapTest() {
         super(PredicatedMapTest.class.getSimpleName());
diff --git 
a/src/test/java/org/apache/commons/collections4/map/PredicatedSortedMapTest.java
 
b/src/test/java/org/apache/commons/collections4/map/PredicatedSortedMapTest.java
index 51e7d50c1..dfb6c9543 100644
--- 
a/src/test/java/org/apache/commons/collections4/map/PredicatedSortedMapTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/map/PredicatedSortedMapTest.java
@@ -52,7 +52,7 @@ public class PredicatedSortedMapTest<K, V> extends 
AbstractSortedMapTest<K, V> {
 
     protected static final Predicate<Object> truePredicate = 
TruePredicate.truePredicate();
 
-    protected static final Predicate<Object> testPredicate = o -> o instanceof 
String;
+    protected static final Predicate<Object> testPredicate = 
String.class::isInstance;
 
     protected final Comparator<K> reverseStringComparator = new 
ReverseStringComparator();
 
diff --git 
a/src/test/java/org/apache/commons/collections4/multiset/PredicatedMultiSetTest.java
 
b/src/test/java/org/apache/commons/collections4/multiset/PredicatedMultiSetTest.java
index 3f4a5bcac..b12ef5315 100644
--- 
a/src/test/java/org/apache/commons/collections4/multiset/PredicatedMultiSetTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/multiset/PredicatedMultiSetTest.java
@@ -41,7 +41,7 @@ public class PredicatedMultiSetTest<T> extends 
AbstractMultiSetTest<T> {
     }
 
     protected Predicate<T> stringPredicate() {
-        return o -> o instanceof String;
+        return String.class::isInstance;
     }
 
     protected Predicate<T> truePredicate = TruePredicate.<T>truePredicate();
diff --git 
a/src/test/java/org/apache/commons/collections4/queue/PredicatedQueueTest.java 
b/src/test/java/org/apache/commons/collections4/queue/PredicatedQueueTest.java
index 46ee5413b..c5f7eda0b 100644
--- 
a/src/test/java/org/apache/commons/collections4/queue/PredicatedQueueTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/queue/PredicatedQueueTest.java
@@ -70,7 +70,7 @@ public class PredicatedQueueTest<E> extends 
AbstractQueueTest<E> {
         return list;
     }
 
-    protected Predicate<E> testPredicate = o -> o instanceof String;
+    protected Predicate<E> testPredicate = String.class::isInstance;
 
     public Queue<E> makeTestQueue() {
         return decorateCollection(new LinkedList<>(), testPredicate);
diff --git 
a/src/test/java/org/apache/commons/collections4/set/PredicatedSetTest.java 
b/src/test/java/org/apache/commons/collections4/set/PredicatedSetTest.java
index afba189e2..8c572d79e 100644
--- a/src/test/java/org/apache/commons/collections4/set/PredicatedSetTest.java
+++ b/src/test/java/org/apache/commons/collections4/set/PredicatedSetTest.java
@@ -57,7 +57,7 @@ public class PredicatedSetTest<E> extends AbstractSetTest<E> {
     }
 
     protected Predicate<E> testPredicate =
-        o -> o instanceof String;
+        String.class::isInstance;
 
     protected PredicatedSet<E> makeTestSet() {
         return decorateSet(new HashSet<>(), testPredicate);

Reply via email to