You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/21 03:08:13 UTC

[commons-collections] branch master updated: Use final.

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 080a393  Use final.
080a393 is described below

commit 080a393b4fb33dbdfd4292c219fdce30bd5c19d5
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 20 22:08:08 2020 -0500

    Use final.
---
 .../bloomfilter/AbstractBloomFilter.java           |  2 +-
 .../bloomfilter/ArrayCountingBloomFilter.java      | 20 ++++-----
 .../bloomfilter/BloomFilterIndexer.java            |  6 +--
 .../collections4/bloomfilter/IndexFilters.java     |  2 +-
 .../bloomfilter/hasher/DynamicHasher.java          |  4 +-
 .../bloomfilter/hasher/HashFunctionValidator.java  |  6 +--
 .../collections4/bloomfilter/hasher/Hasher.java    |  6 +--
 .../bloomfilter/hasher/function/Signatures.java    |  2 +-
 .../properties/AbstractPropertiesFactory.java      |  2 +-
 .../apache/commons/collections4/MapUtilsTest.java  | 18 ++++----
 .../bloomfilter/AbstractBloomFilterTest.java       | 18 ++++----
 .../bloomfilter/ArrayCountingBloomFilterTest.java  | 50 +++++++++++-----------
 .../bloomfilter/BitSetBloomFilterTest.java         |  2 +-
 .../bloomfilter/BloomFilterIndexerTest.java        |  2 +-
 .../bloomfilter/FixedIndexesTestHasher.java        |  8 ++--
 .../bloomfilter/HasherBloomFilterTest.java         |  6 +--
 .../collections4/bloomfilter/IndexFilterTest.java  |  6 +--
 .../bloomfilter/SetOperationsTest.java             | 14 +++---
 .../hasher/DynamicHasherBuilderTest.java           |  4 +-
 .../bloomfilter/hasher/HasherBuilderTest.java      |  4 +-
 .../collections4/keyvalue/MultiKeyTest.java        |  6 +--
 .../multimap/UnmodifiableMultiValuedMapTest.java   |  2 +-
 22 files changed, 95 insertions(+), 95 deletions(-)

diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilter.java
index 0e82d5f..85d66b6 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilter.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilter.java
@@ -175,7 +175,7 @@ public abstract class AbstractBloomFilter implements BloomFilter {
      * @param operation the operation (e.g. OR, XOR)
      * @return the cardinality
      */
-    private int opCardinality(final BloomFilter other, LongBinaryOperator operation) {
+    private int opCardinality(final BloomFilter other, final LongBinaryOperator operation) {
         verifyShape(other);
         final long[] mine = getBits();
         final long[] theirs = other.getBits();
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 b1b7f40..0722b92 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java
@@ -152,7 +152,7 @@ public class ArrayCountingBloomFilter extends AbstractBloomFilter implements Cou
     }
 
     @Override
-    public boolean contains(BloomFilter other) {
+    public boolean contains(final BloomFilter other) {
         // The AbstractBloomFilter implementation converts both filters to long[] bits.
         // This would involve checking all indexes in this filter against zero.
         // Ideally we use an iterator of bit indexes to allow fail-fast on the
@@ -230,25 +230,25 @@ public class ArrayCountingBloomFilter extends AbstractBloomFilter implements Cou
     }
 
     @Override
-    public boolean remove(BloomFilter other) {
+    public boolean remove(final BloomFilter other) {
         applyAsBloomFilter(other, this::decrement);
         return isValid();
     }
 
     @Override
-    public boolean remove(Hasher hasher) {
+    public boolean remove(final Hasher hasher) {
         applyAsHasher(hasher, this::decrement);
         return isValid();
     }
 
     @Override
-    public boolean add(CountingBloomFilter other) {
+    public boolean add(final CountingBloomFilter other) {
         applyAsCountingBloomFilter(other, this::add);
         return isValid();
     }
 
     @Override
-    public boolean subtract(CountingBloomFilter other) {
+    public boolean subtract(final CountingBloomFilter other) {
         applyAsCountingBloomFilter(other, this::subtract);
         return isValid();
     }
@@ -273,7 +273,7 @@ public class ArrayCountingBloomFilter extends AbstractBloomFilter implements Cou
     }
 
     @Override
-    public void forEachCount(BitCountConsumer action) {
+    public void forEachCount(final BitCountConsumer action) {
         for (int i = 0; i < counts.length; i++) {
             if (counts[i] != 0) {
                 action.accept(i, counts[i]);
@@ -321,7 +321,7 @@ public class ArrayCountingBloomFilter extends AbstractBloomFilter implements Cou
      *
      * @param idx the index
      */
-    private void increment(int idx) {
+    private void increment(final int idx) {
         final int updated = counts[idx] + 1;
         state |= updated;
         counts[idx] = updated;
@@ -332,7 +332,7 @@ public class ArrayCountingBloomFilter extends AbstractBloomFilter implements Cou
      *
      * @param idx the index
      */
-    private void decrement(int idx) {
+    private void decrement(final int idx) {
         final int updated = counts[idx] - 1;
         state |= updated;
         counts[idx] = updated;
@@ -344,7 +344,7 @@ public class ArrayCountingBloomFilter extends AbstractBloomFilter implements Cou
      * @param idx the index
      * @param addend the amount to add
      */
-    private void add(int idx, int addend) {
+    private void add(final int idx, final int addend) {
         final int updated = counts[idx] + addend;
         state |= updated;
         counts[idx] = updated;
@@ -356,7 +356,7 @@ public class ArrayCountingBloomFilter extends AbstractBloomFilter implements Cou
      * @param idx the index
      * @param subtrahend the amount to subtract
      */
-    private void subtract(int idx, int subtrahend) {
+    private void subtract(final int idx, final int subtrahend) {
         final int updated = counts[idx] - subtrahend;
         state |= updated;
         counts[idx] = updated;
diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexer.java b/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexer.java
index 4f61703..fe9b116 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexer.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexer.java
@@ -32,7 +32,7 @@ public final class BloomFilterIndexer {
      * @param bitIndex the bit index
      * @throws IndexOutOfBoundsException if the index is not positive
      */
-    public static void checkPositive(int bitIndex) {
+    public static void checkPositive(final int bitIndex) {
         if (bitIndex < 0) {
             throw new IndexOutOfBoundsException("Negative bitIndex: " + bitIndex);
         }
@@ -52,7 +52,7 @@ public final class BloomFilterIndexer {
      * @return the filter index
      * @see #checkPositive(int)
      */
-    public static int getLongIndex(int bitIndex) {
+    public static int getLongIndex(final int bitIndex) {
         // An integer divide by 64 is equivalent to a shift of 6 bits if the integer is positive.
         // We do not explicitly check for a negative here. Instead we use a
         // a signed shift. Any negative index will produce a negative value
@@ -74,7 +74,7 @@ public final class BloomFilterIndexer {
      * @return the filter bit
      * @see #checkPositive(int)
      */
-    public static long getLongBit(int bitIndex) {
+    public static long getLongBit(final int bitIndex) {
         // Bit shifts only use the first 6 bits. Thus it is not necessary to mask this
         // using 0x3f (63) or compute bitIndex % 64.
         // Note: If the index is negative the shift will be (64 - (bitIndex & 0x3f)) and
diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexFilters.java b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexFilters.java
index 9b1d5e2..e4adb4f 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexFilters.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexFilters.java
@@ -56,7 +56,7 @@ final class IndexFilters {
      * @throws NullPointerException if the hasher, shape or action are null
      * @see Hasher#iterator(Shape)
      */
-    static void distinctIndexes(Hasher hasher, Shape shape, IntConsumer consumer) {
+    static void distinctIndexes(final Hasher hasher, final Shape shape, final IntConsumer consumer) {
         Objects.requireNonNull(hasher, "hasher");
         Objects.requireNonNull(shape, "shape");
         Objects.requireNonNull(consumer, "consumer");
diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasher.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasher.java
index 6d389ad..ab6b773 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasher.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasher.java
@@ -70,13 +70,13 @@ public class DynamicHasher implements Hasher {
         }
 
         @Override
-        public DynamicHasher.Builder with(CharSequence item, Charset charset) {
+        public DynamicHasher.Builder with(final CharSequence item, final Charset charset) {
             Hasher.Builder.super.with(item, charset);
             return this;
         }
 
         @Override
-        public DynamicHasher.Builder withUnencoded(CharSequence item) {
+        public DynamicHasher.Builder withUnencoded(final CharSequence item) {
             Hasher.Builder.super.withUnencoded(item);
             return this;
         }
diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/HashFunctionValidator.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/HashFunctionValidator.java
index b9876e8..3ec0753 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/HashFunctionValidator.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/HashFunctionValidator.java
@@ -47,7 +47,7 @@ public final class HashFunctionValidator {
      * @see String#toLowerCase(Locale)
      * @see Locale#ROOT
      */
-    static int hash(HashFunctionIdentity a) {
+    static int hash(final HashFunctionIdentity a) {
         return Objects.hash(a.getSignedness(),
                             a.getProcessType(),
                             a.getName().toLowerCase(Locale.ROOT));
@@ -66,7 +66,7 @@ public final class HashFunctionValidator {
      * @return true, if successful
      * @see String#equalsIgnoreCase(String)
      */
-    public static boolean areEqual(HashFunctionIdentity a, HashFunctionIdentity b) {
+    public static boolean areEqual(final HashFunctionIdentity a, final HashFunctionIdentity b) {
         return (a.getSignedness() == b.getSignedness() &&
                 a.getProcessType() == b.getProcessType() &&
                 a.getName().equalsIgnoreCase(b.getName()));
@@ -81,7 +81,7 @@ public final class HashFunctionValidator {
      * @see #areEqual(HashFunctionIdentity, HashFunctionIdentity)
      * @throws IllegalArgumentException if the hash functions are not equal
      */
-    public static void checkAreEqual(HashFunctionIdentity a, HashFunctionIdentity b) {
+    public static void checkAreEqual(final HashFunctionIdentity a, final HashFunctionIdentity b) {
         if (!areEqual(a, b)) {
             throw new IllegalArgumentException(String.format("Hash functions are not equal: (%s) != (%s)",
                 HashFunctionIdentity.asCommonString(a), HashFunctionIdentity.asCommonString(b)));
diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Hasher.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Hasher.java
index 8f5d5c2..3700567 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Hasher.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Hasher.java
@@ -82,7 +82,7 @@ public interface Hasher {
          * @param charset the character set
          * @return a reference to this object
          */
-        default Builder with(CharSequence item, Charset charset) {
+        default Builder with(final CharSequence item, final Charset charset) {
             return with(item.toString().getBytes(charset));
         }
 
@@ -93,8 +93,8 @@ public interface Hasher {
          * @param item the item to add
          * @return a reference to this object
          */
-        default Builder withUnencoded(CharSequence item) {
-            int length = item.length();
+        default Builder withUnencoded(final CharSequence item) {
+            final int length = item.length();
             final byte[] bytes = new byte[length * 2];
             for (int i = 0; i < length; i++) {
                 final char ch = item.charAt(i);
diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/Signatures.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/Signatures.java
index b68e92e..b7f35ac 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/Signatures.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/Signatures.java
@@ -40,7 +40,7 @@ final class Signatures {
      * @see HashFunctionIdentity#prepareSignatureBuffer(HashFunctionIdentity)
      * @see HashFunction#apply(byte[], int)
      */
-    static long getSignature(HashFunction hashFunction) {
+    static long getSignature(final HashFunction hashFunction) {
         return hashFunction.apply(HashFunctionIdentity.prepareSignatureBuffer(hashFunction), 0);
     }
 }
diff --git a/src/main/java/org/apache/commons/collections4/properties/AbstractPropertiesFactory.java b/src/main/java/org/apache/commons/collections4/properties/AbstractPropertiesFactory.java
index 00423fa..d278f30 100644
--- a/src/main/java/org/apache/commons/collections4/properties/AbstractPropertiesFactory.java
+++ b/src/main/java/org/apache/commons/collections4/properties/AbstractPropertiesFactory.java
@@ -53,7 +53,7 @@ public abstract class AbstractPropertiesFactory<T extends Properties> {
         /** XML file format. */
         XML;
 
-        static PropertyFormat toPropertyFormat(String fileName) {
+        static PropertyFormat toPropertyFormat(final String fileName) {
             return Objects.requireNonNull(fileName, "fileName").endsWith(".xml") ? XML : PROPERTIES;
         }
     }
diff --git a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
index f14c209..c002052 100644
--- a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
@@ -159,18 +159,18 @@ public class MapUtilsTest {
 
     @Test
     public void testInvertEmptyMap() {
-        Map<String, String> emptyMap = new HashMap<>();
-        Map<String, String> resultMap = MapUtils.invertMap(emptyMap);
+        final Map<String, String> emptyMap = new HashMap<>();
+        final Map<String, String> resultMap = MapUtils.invertMap(emptyMap);
         assertEquals(emptyMap, resultMap);
     }
 
     @Test
     public void testInvertMapNull() {
-        Map<String, String> nullMap = null;
-        Exception exception = assertThrows(NullPointerException.class, () -> {
+        final Map<String, String> nullMap = null;
+        final Exception exception = assertThrows(NullPointerException.class, () -> {
             MapUtils.invertMap(nullMap);
         });
-        String actualMessage = exception.getMessage();
+        final String actualMessage = exception.getMessage();
         assertTrue(actualMessage.contains("map"));
     }
 
@@ -1016,28 +1016,28 @@ public class MapUtilsTest {
 
     @Test
     public void testUnmodifiableMap() {
-        Exception exception = assertThrows(UnsupportedOperationException.class, () -> {
+        final Exception exception = assertThrows(UnsupportedOperationException.class, () -> {
             MapUtils.unmodifiableMap(new HashMap<>()).clear();
         });
     }
 
     @Test
     public void testUnmodifiableSortedMap() {
-        Exception exception = assertThrows(UnsupportedOperationException.class, () -> {
+        final Exception exception = assertThrows(UnsupportedOperationException.class, () -> {
             MapUtils.unmodifiableSortedMap(new TreeMap<>()).clear();
         });
     }
 
     @Test
     public void testFixedSizeMap() {
-        Exception exception = assertThrows(IllegalArgumentException.class, () -> {
+        final Exception exception = assertThrows(IllegalArgumentException.class, () -> {
             MapUtils.fixedSizeMap(new HashMap<>()).put(new Object(), new Object());
         });
     }
 
     @Test
     public void testFixedSizeSortedMap() {
-        Exception exception = assertThrows(IllegalArgumentException.class, () -> {
+        final Exception exception = assertThrows(IllegalArgumentException.class, () -> {
             MapUtils.fixedSizeSortedMap(new TreeMap<Long, Long>()).put(1L, 1L);
         });
     }
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 b37a5a9..baaec37 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java
@@ -49,7 +49,7 @@ public abstract class AbstractBloomFilterTest {
         /** The bits. */
         final BitSet bits;
 
-        protected TestBloomFilter(Shape shape, BitSet bits) {
+        protected TestBloomFilter(final Shape shape, final BitSet bits) {
             super(shape);
             this.bits = bits;
         }
@@ -65,12 +65,12 @@ public abstract class AbstractBloomFilterTest {
         }
 
         @Override
-        public boolean merge(BloomFilter other) {
+        public boolean merge(final BloomFilter other) {
             throw new UnsupportedOperationException();
         }
 
         @Override
-        public boolean merge(Hasher hasher) {
+        public boolean merge(final Hasher hasher) {
             throw new UnsupportedOperationException();
         }
     }
@@ -163,7 +163,7 @@ public abstract class AbstractBloomFilterTest {
      *
      * @param filterFactory the factory function to create the filter
      */
-    private void andCardinalityTest(BiFunction<Hasher, Shape, BloomFilter> filterFactory) {
+    private void andCardinalityTest(final BiFunction<Hasher, Shape, BloomFilter> filterFactory) {
         final List<Integer> lst = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17);
         final Hasher hasher = new StaticHasher(lst.iterator(), shape);
 
@@ -372,8 +372,8 @@ public abstract class AbstractBloomFilterTest {
      * @param shape the shape of the filter.
      * @return a BloomFilter implementation.
      */
-    private AbstractBloomFilter createGenericFilter(Hasher hasher, Shape shape) {
-        BitSet bits = new BitSet();
+    private AbstractBloomFilter createGenericFilter(final Hasher hasher, final Shape shape) {
+        final BitSet bits = new BitSet();
         hasher.iterator(shape).forEachRemaining((IntConsumer) bits::set);
         return new TestBloomFilter(shape, bits);
     }
@@ -455,7 +455,7 @@ public abstract class AbstractBloomFilterTest {
      *
      * @param filterFactory the factory function to create the filter
      */
-    private void mergeTest_BloomFilter(BiFunction<Hasher, Shape, BloomFilter> filterFactory) {
+    private void mergeTest_BloomFilter(final BiFunction<Hasher, Shape, BloomFilter> filterFactory) {
         final List<Integer> lst = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17);
         final Hasher hasher = new StaticHasher(lst.iterator(), shape);
 
@@ -553,7 +553,7 @@ public abstract class AbstractBloomFilterTest {
      *
      * @param filterFactory the factory function to create the filter
      */
-    private void orCardinalityTest(BiFunction<Hasher, Shape, BloomFilter> filterFactory) {
+    private void orCardinalityTest(final BiFunction<Hasher, Shape, BloomFilter> filterFactory) {
         final List<Integer> lst = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17);
         final Hasher hasher = new StaticHasher(lst.iterator(), shape);
 
@@ -607,7 +607,7 @@ public abstract class AbstractBloomFilterTest {
      *
      * @param filterFactory the factory function to create the filter
      */
-    private void xorCardinalityTest(BiFunction<Hasher, Shape, BloomFilter> filterFactory) {
+    private void xorCardinalityTest(final BiFunction<Hasher, Shape, BloomFilter> filterFactory) {
         final List<Integer> lst = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17);
         final Hasher hasher = new StaticHasher(lst.iterator(), shape);
 
diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilterTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilterTest.java
index e7fc7bf..50a20af 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilterTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilterTest.java
@@ -40,8 +40,8 @@ public class ArrayCountingBloomFilterTest extends AbstractBloomFilterTest {
     /**
      * Function to convert int arrays to BloomFilters for testing.
      */
-    private Function<int[], BloomFilter> converter = counts -> {
-        BloomFilter testingFilter = new BitSetBloomFilter(shape);
+    private final Function<int[], BloomFilter> converter = counts -> {
+        final BloomFilter testingFilter = new BitSetBloomFilter(shape);
         testingFilter.merge(new FixedIndexesTestHasher(shape, counts));
         return testingFilter;
     };
@@ -53,16 +53,16 @@ public class ArrayCountingBloomFilterTest extends AbstractBloomFilterTest {
 
     @Override
     protected ArrayCountingBloomFilter createFilter(final Hasher hasher, final Shape shape) {
-        ArrayCountingBloomFilter result = new ArrayCountingBloomFilter(shape);
+        final ArrayCountingBloomFilter result = new ArrayCountingBloomFilter(shape);
         result.merge( hasher );
         return result;
     }
 
-    private ArrayCountingBloomFilter createFromCounts(int[] counts) {
+    private ArrayCountingBloomFilter createFromCounts(final int[] counts) {
         // Use a dummy filter to add the counts to an empty filter
         final CountingBloomFilter dummy = new ArrayCountingBloomFilter(shape) {
             @Override
-            public void forEachCount(BitCountConsumer action) {
+            public void forEachCount(final BitCountConsumer action) {
                 for (int i = 0; i < counts.length; i++) {
                     action.accept(i, counts[i]);
                 }
@@ -80,7 +80,7 @@ public class ArrayCountingBloomFilterTest extends AbstractBloomFilterTest {
      * @param bf the bloom filter
      * @param expected the expected counts
      */
-    private static void assertCounts(CountingBloomFilter bf, int[] expected) {
+    private static void assertCounts(final CountingBloomFilter bf, final int[] expected) {
         final Map<Integer, Integer> m = new HashMap<>();
         bf.forEachCount(m::put);
         int zeros = 0;
@@ -208,10 +208,10 @@ public class ArrayCountingBloomFilterTest extends AbstractBloomFilterTest {
      * @param counts the counts
      * @return the new counts
      */
-    private static int[] createDuplicates(int[] counts) {
+    private static int[] createDuplicates(final int[] counts) {
         // Duplicate some values randomly
         final int length = counts.length;
-        int[] countsWithDuplicates = Arrays.copyOf(counts, 2 * length);
+        final int[] countsWithDuplicates = Arrays.copyOf(counts, 2 * length);
         for (int i = length; i < countsWithDuplicates.length; i++) {
             // Copy a random value from the counts into the end position
             countsWithDuplicates[i] = countsWithDuplicates[ThreadLocalRandom.current().nextInt(i)];
@@ -227,8 +227,8 @@ public class ArrayCountingBloomFilterTest extends AbstractBloomFilterTest {
      * @param converter the converter
      * @param merge the merge operation
      */
-    private <F> void assertMerge(Function<int[], F> converter,
-            BiPredicate<ArrayCountingBloomFilter, F> merge) {
+    private <F> void assertMerge(final Function<int[], F> converter,
+            final BiPredicate<ArrayCountingBloomFilter, F> merge) {
         final int[] indexes1 = {   1, 2,    4, 5, 6};
         final int[] indexes2 = {         3, 4,    6};
         final int[] expected = {0, 1, 1, 1, 2, 1, 2};
@@ -243,8 +243,8 @@ public class ArrayCountingBloomFilterTest extends AbstractBloomFilterTest {
      * @param converter the converter
      * @param remove the remove operation
      */
-    private <F> void assertRemove(Function<int[], F> converter,
-            BiPredicate<ArrayCountingBloomFilter, F> remove) {
+    private <F> void assertRemove(final Function<int[], F> converter,
+            final BiPredicate<ArrayCountingBloomFilter, F> remove) {
         final int[] indexes1 = {   1, 2,    4, 5, 6};
         final int[] indexes2 = {      2,       5, 6};
         final int[] expected = {0, 1, 0, 0, 1, 0, 0};
@@ -267,10 +267,10 @@ public class ArrayCountingBloomFilterTest extends AbstractBloomFilterTest {
      * @param isValid the expected value for the operation result
      * @param expected the expected counts after the operation
      */
-    private <F> void assertOperation(int[] indexes1, int[] indexes2,
-            Function<int[], F> converter,
-            BiPredicate<ArrayCountingBloomFilter, F> operation,
-            boolean isValid, int[] expected) {
+    private <F> void assertOperation(final int[] indexes1, final int[] indexes2,
+            final Function<int[], F> converter,
+            final BiPredicate<ArrayCountingBloomFilter, F> operation,
+            final boolean isValid, final int[] expected) {
         final Hasher hasher = new FixedIndexesTestHasher(shape, indexes1);
         final ArrayCountingBloomFilter bf = createFilter(hasher, shape);
         final F filter = converter.apply(indexes2);
@@ -288,7 +288,7 @@ public class ArrayCountingBloomFilterTest extends AbstractBloomFilterTest {
         final Hasher hasher = new FixedIndexesTestHasher(shape, 1, 2, 3);
         final ArrayCountingBloomFilter bf = createFilter(hasher, shape);
 
-        ArrayCountingBloomFilter bf2 = createFromCounts(new int[] {0, 0, Integer.MAX_VALUE});
+        final ArrayCountingBloomFilter bf2 = createFromCounts(new int[] {0, 0, Integer.MAX_VALUE});
 
         // Small + 1 = OK
         // should not fail as the counts are ignored
@@ -313,10 +313,10 @@ public class ArrayCountingBloomFilterTest extends AbstractBloomFilterTest {
     @Test
     public void removeTest_Negative() {
         final Hasher hasher = new FixedIndexesTestHasher(shape, 1, 2, 3);
-        ArrayCountingBloomFilter bf = createFilter(hasher, shape);
+        final ArrayCountingBloomFilter bf = createFilter(hasher, shape);
 
         final Hasher hasher2 = new FixedIndexesTestHasher(shape, 2);
-        ArrayCountingBloomFilter bf2 = createFilter(hasher2, shape);
+        final ArrayCountingBloomFilter bf2 = createFilter(hasher2, shape);
 
         // More - Less = OK
         bf.remove(bf2);
@@ -441,9 +441,9 @@ public class ArrayCountingBloomFilterTest extends AbstractBloomFilterTest {
      * @param isValid the expected value for the operation result
      * @param expected the expected counts after the operation
      */
-    private void assertCountingOperation(int[] counts1, int[] counts2,
-            BiPredicate<ArrayCountingBloomFilter, ArrayCountingBloomFilter> operation,
-            boolean isValid, int[] expected) {
+    private void assertCountingOperation(final int[] counts1, final int[] counts2,
+            final BiPredicate<ArrayCountingBloomFilter, ArrayCountingBloomFilter> operation,
+            final boolean isValid, final int[] expected) {
         final ArrayCountingBloomFilter bf1 = createFromCounts(counts1);
         final ArrayCountingBloomFilter bf2 = createFromCounts(counts2);
         final boolean result = operation.test(bf1, bf2);
@@ -524,9 +524,9 @@ public class ArrayCountingBloomFilterTest extends AbstractBloomFilterTest {
      * @param operation the operation
      * @param expected the expected cardinality
      */
-    private void assertCardinalityOperation(int[] counts1, int[] counts2,
-            ToIntBiFunction<ArrayCountingBloomFilter, ArrayCountingBloomFilter> operation,
-            int expected) {
+    private void assertCardinalityOperation(final int[] counts1, final int[] counts2,
+            final ToIntBiFunction<ArrayCountingBloomFilter, ArrayCountingBloomFilter> operation,
+            final int expected) {
         final ArrayCountingBloomFilter bf1 = createFromCounts(counts1);
         final ArrayCountingBloomFilter bf2 = createFromCounts(counts2);
         assertEquals(expected, operation.applyAsInt(bf1, bf2));
diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/BitSetBloomFilterTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/BitSetBloomFilterTest.java
index dae71d5..9a2078d 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/BitSetBloomFilterTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/BitSetBloomFilterTest.java
@@ -30,7 +30,7 @@ public class BitSetBloomFilterTest extends AbstractBloomFilterTest {
 
     @Override
     protected BitSetBloomFilter createFilter(final Hasher hasher, final Shape shape) {
-        BitSetBloomFilter testFilter = new BitSetBloomFilter(shape);
+        final BitSetBloomFilter testFilter = new BitSetBloomFilter(shape);
         testFilter.merge( hasher );
         return testFilter;
     }
diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexerTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexerTest.java
index 5c063ff..b802308 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexerTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexerTest.java
@@ -72,7 +72,7 @@ public class BloomFilterIndexerTest {
      */
     private static int[] getIndexes() {
         final Random rng = ThreadLocalRandom.current();
-        ArrayList<Integer> indexes = new ArrayList<>(40);
+        final ArrayList<Integer> indexes = new ArrayList<>(40);
         for (int i = 0; i < 10; i++) {
             // random positive numbers
             indexes.add(rng.nextInt() >>> 1);
diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/FixedIndexesTestHasher.java b/src/test/java/org/apache/commons/collections4/bloomfilter/FixedIndexesTestHasher.java
index 6dec4a7..ec48862 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/FixedIndexesTestHasher.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/FixedIndexesTestHasher.java
@@ -31,9 +31,9 @@ import java.util.PrimitiveIterator.OfInt;
  */
 class FixedIndexesTestHasher implements Hasher {
     /** The shape. */
-    private Shape shape;
+    private final Shape shape;
     /** The indexes. */
-    private int[] indexes;
+    private final int[] indexes;
 
     /**
      * Create an instance.
@@ -41,13 +41,13 @@ class FixedIndexesTestHasher implements Hasher {
      * @param shape the shape
      * @param indexes the indexes
      */
-    FixedIndexesTestHasher(Shape shape, int... indexes) {
+    FixedIndexesTestHasher(final Shape shape, final int... indexes) {
         this.shape = shape;
         this.indexes = indexes;
     }
 
     @Override
-    public OfInt iterator(Shape shape) {
+    public OfInt iterator(final Shape shape) {
         if (!this.shape.equals(shape)) {
             throw new IllegalArgumentException(
                 String.format("shape (%s) does not match internal shape (%s)", shape, this.shape));
diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilterTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilterTest.java
index e9b63ba..ddb8752 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilterTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilterTest.java
@@ -64,7 +64,7 @@ public class HasherBloomFilterTest extends AbstractBloomFilterTest {
      */
     @Test
     public void getBitsTest_Empty() {
-        BloomFilter filter = createEmptyFilter(shape);
+        final BloomFilter filter = createEmptyFilter(shape);
         Assert.assertArrayEquals(new long[0], filter.getBits());
     }
 
@@ -74,11 +74,11 @@ public class HasherBloomFilterTest extends AbstractBloomFilterTest {
      */
     @Test
     public void getBitsTest_LowestBitOnly() {
-        BloomFilter filter = createEmptyFilter(shape);
+        final BloomFilter filter = createEmptyFilter(shape);
         // Set the lowest bit index only.
         filter.merge(new Hasher() {
             @Override
-            public OfInt iterator(Shape shape) {
+            public OfInt iterator(final Shape shape) {
                 return Arrays.stream(new int[] {0}).iterator();
             }
 
diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/IndexFilterTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/IndexFilterTest.java
index ad008ba..dfa576f 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/IndexFilterTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/IndexFilterTest.java
@@ -39,7 +39,7 @@ public class IndexFilterTest {
      * This is used as an argument to a Hasher that just returns fixed indexes
      * so the parameters do not matter.
      */
-    private Shape shape = new Shape(new HashFunctionIdentityImpl(
+    private final Shape shape = new Shape(new HashFunctionIdentityImpl(
         "Apache Commons Collections", "Dummy", Signedness.SIGNED, ProcessType.CYCLIC, 0L),
         50, 3000, 4);
 
@@ -85,7 +85,7 @@ public class IndexFilterTest {
         assertFilter(1, 4, 4, 6, 7, 7, 7, 7, 7, 9);
     }
 
-    private void assertFilter(int... indexes) {
+    private void assertFilter(final int... indexes) {
         final FixedIndexesTestHasher hasher = new FixedIndexesTestHasher(shape, indexes);
         final Set<Integer> expected = Arrays.stream(indexes).boxed().collect(Collectors.toSet());
         final ArrayList<Integer> actual = new ArrayList<>();
@@ -96,7 +96,7 @@ public class IndexFilterTest {
         // Check the array has all the values.
         // We do not currently check the order of indexes from the
         // hasher.iterator() function.
-        for (Integer index : actual) {
+        for (final Integer index : actual) {
             Assert.assertTrue(expected.contains(index));
         }
     }
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 0d2d53a..f06974f 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/SetOperationsTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/SetOperationsTest.java
@@ -63,19 +63,19 @@ public class SetOperationsTest {
 
     @Test
     public void testDifferentShapesThrows() {
-        List<Integer> lst = Arrays.asList(1, 2);
-        Hasher hasher = new StaticHasher(lst.iterator(), shape);
-        BloomFilter filter1 = new HasherBloomFilter(hasher, shape);
+        final List<Integer> lst = Arrays.asList(1, 2);
+        final Hasher hasher = new StaticHasher(lst.iterator(), shape);
+        final BloomFilter filter1 = new HasherBloomFilter(hasher, shape);
 
         final Shape shape2 = new Shape(testFunction, 3, 72, 18);
-        List<Integer> lst2 = Arrays.asList(2, 3);
-        Hasher hasher2 = new StaticHasher(lst2.iterator(), shape2);
-        BloomFilter filter2 = new HasherBloomFilter(hasher2, shape2);
+        final List<Integer> lst2 = Arrays.asList(2, 3);
+        final Hasher hasher2 = new StaticHasher(lst2.iterator(), shape2);
+        final BloomFilter filter2 = new HasherBloomFilter(hasher2, shape2);
 
         try {
             SetOperations.cosineDistance(filter1, filter2);
             Assert.fail("Expected an IllegalArgumentException");
-        } catch (IllegalArgumentException expected) {
+        } catch (final IllegalArgumentException expected) {
             // Ignore
         }
     }
diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasherBuilderTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasherBuilderTest.java
index 1f2c1e2..49b4057 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasherBuilderTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasherBuilderTest.java
@@ -35,9 +35,9 @@ import org.junit.Test;
 public class DynamicHasherBuilderTest {
 
     private DynamicHasher.Builder builder;
-    private HashFunction hf = new MD5Cyclic();
+    private final HashFunction hf = new MD5Cyclic();
     private final Shape shape = new Shape(hf, 1, 345, 1);
-    private String testString = HasherBuilderTest.getExtendedString();
+    private final String testString = HasherBuilderTest.getExtendedString();
 
     /**
      * Tests that hashing a byte array works as expected.
diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HasherBuilderTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HasherBuilderTest.java
index 0216075..1231aa3 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HasherBuilderTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HasherBuilderTest.java
@@ -45,7 +45,7 @@ public class HasherBuilderTest {
         }
 
         @Override
-        public Builder with(byte[] item) {
+        public Builder with(final byte[] item) {
             items.add(item);
             return this;
         }
@@ -62,7 +62,7 @@ public class HasherBuilderTest {
             for (final Charset cs : new Charset[] {
                 StandardCharsets.ISO_8859_1, StandardCharsets.UTF_8, StandardCharsets.UTF_16
             }) {
-                TestBuilder builder = new TestBuilder();
+                final TestBuilder builder = new TestBuilder();
                 builder.with(s, cs);
                 Assert.assertArrayEquals(s.getBytes(cs), builder.items.get(0));
             }
diff --git a/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java b/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java
index 0eec774..bf597b2 100644
--- a/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java
+++ b/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java
@@ -291,9 +291,9 @@ public class MultiKeyTest {
 
     @Test
     public void testTwoArgCtor() {
-        MultiKeyTest key1 = new MultiKeyTest();
-        MultiKeyTest key2 = new MultiKeyTest();
-        MultiKeyTest[] keys = new MultiKey<>(key1, key2).getKeys();
+        final MultiKeyTest key1 = new MultiKeyTest();
+        final MultiKeyTest key2 = new MultiKeyTest();
+        final MultiKeyTest[] keys = new MultiKey<>(key1, key2).getKeys();
         assertNotNull(keys);
     }
 
diff --git a/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java
index 5d87800..c7aa751 100644
--- a/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java
@@ -52,7 +52,7 @@ public class UnmodifiableMultiValuedMapTest<K, V> extends AbstractMultiValuedMap
      * with makeFullMap(). See COLLECTIONS-769.
      * @param map the MultiValuedMap<K, V> to check
      */
-    private void assertMapContainsAllValues(MultiValuedMap<K, V> map) {
+    private void assertMapContainsAllValues(final MultiValuedMap<K, V> map) {
         assertEquals("[uno, un]", map.get((K) "one").toString());
         assertEquals("[dos, deux]", map.get((K) "two").toString());
         assertEquals("[tres, trois]", map.get((K) "three").toString());