diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml index e0edda7eb0..eb410f1f70 100644 --- a/src/conf/checkstyle.xml +++ b/src/conf/checkstyle.xml @@ -42,6 +42,7 @@ limitations under the License. + diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingLongPredicate.java b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingLongPredicate.java index c03a21900b..83d4c1a8cb 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingLongPredicate.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingLongPredicate.java @@ -25,7 +25,7 @@ * execute the @code{text} with a zero value for each remaining @{code idx} value. */ class CountingLongPredicate implements LongPredicate { - private int idx = 0; + private int idx; private final long[] ary; private final LongBiPredicate func; 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 dd73a423d1..7c284de379 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexProducer.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexProducer.java @@ -82,7 +82,7 @@ static IndexProducer fromBitMapProducer(final BitMapProducer producer) { Objects.requireNonNull(producer, "producer"); return consumer -> { final LongPredicate longPredicate = new LongPredicate() { - int wordIdx = 0; + int wordIdx; @Override public boolean test(long word) { diff --git a/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java b/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java index f34021c340..2b4af4d7e6 100644 --- a/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java @@ -45,7 +45,7 @@ public class ClosureUtilsTest { private static final Object cString = "Hello"; static class MockClosure implements Closure { - int count = 0; + int count; @Override public void execute(final T object) { @@ -58,7 +58,7 @@ public void reset() { } static class MockTransformer implements Transformer { - int count = 0; + int count; @Override public T transform(final T object) { diff --git a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java index f1e6a2f8e9..a562524168 100644 --- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java @@ -69,54 +69,54 @@ public class CollectionUtilsTest extends MockTestCase { /** * Collection of {@link Integer}s */ - private List collectionA = null; + private List collectionA; /** * Collection of {@link Long}s */ - private List collectionB = null; + private List collectionB; /** * Collection of {@link Integer}s that are equivalent to the Longs in * collectionB. */ - private Collection collectionC = null; + private Collection collectionC; /** * Sorted Collection of {@link Integer}s */ - private Collection collectionD = null; + private Collection collectionD; /** * Sorted Collection of {@link Integer}s */ - private Collection collectionE = null; + private Collection collectionE; /** * Collection of {@link Integer}s, bound as {@link Number}s */ - private Collection collectionA2 = null; + private Collection collectionA2; /** * Collection of {@link Long}s, bound as {@link Number}s */ - private Collection collectionB2 = null; + private Collection collectionB2; /** * Collection of {@link Integer}s (cast as {@link Number}s) that are * equivalent to the Longs in collectionB. */ - private Collection collectionC2 = null; + private Collection collectionC2; - private Iterable iterableA = null; + private Iterable iterableA; - private Iterable iterableB = null; + private Iterable iterableB; - private Iterable iterableC = null; + private Iterable iterableC; - private Iterable iterableA2 = null; + private Iterable iterableA2; - private Iterable iterableB2 = null; + private Iterable iterableB2; private final Collection emptyCollection = new ArrayList<>(1); diff --git a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java index 014852b05a..3ed25c8c8e 100644 --- a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java @@ -168,7 +168,7 @@ public int hashCode() { // please Findbugs } public static class Mock3 { - private static int cCounter = 0; + private static int cCounter; private final int iVal; public Mock3() { iVal = cCounter++; diff --git a/src/test/java/org/apache/commons/collections4/FluentIterableTest.java b/src/test/java/org/apache/commons/collections4/FluentIterableTest.java index a405aa9ba2..5f4481218c 100644 --- a/src/test/java/org/apache/commons/collections4/FluentIterableTest.java +++ b/src/test/java/org/apache/commons/collections4/FluentIterableTest.java @@ -47,27 +47,27 @@ public class FluentIterableTest { /** * Iterable of {@link Integer}s */ - private Iterable iterableA = null; + private Iterable iterableA; /** * Iterable of {@link Long}s */ - private Iterable iterableB = null; + private Iterable iterableB; /** * Collection of even {@link Integer}s */ - private Iterable iterableEven = null; + private Iterable iterableEven; /** * Collection of odd {@link Integer}s */ - private Iterable iterableOdd = null; + private Iterable iterableOdd; /** * An empty Iterable. */ - private Iterable emptyIterable = null; + private Iterable emptyIterable; @BeforeEach public void setUp() { diff --git a/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java b/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java index 4a844b36f1..028121ab44 100644 --- a/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java @@ -50,17 +50,17 @@ public class IterableUtilsTest { /** * Iterable of {@link Integer}s */ - private Iterable iterableA = null; + private Iterable iterableA; /** * Iterable of {@link Long}s */ - private Iterable iterableB = null; + private Iterable iterableB; /** * An empty Iterable. */ - private Iterable emptyIterable = null; + private Iterable emptyIterable; @BeforeEach public void setUp() { diff --git a/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java b/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java index fca963a1d0..aafbacaf12 100644 --- a/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java @@ -70,21 +70,21 @@ public class IteratorUtilsTest { /** * Collection of {@link Integer}s */ - private List collectionA = null; + private List collectionA; /** * Collection of even {@link Integer}s */ - private List collectionEven = null; + private List collectionEven; /** * Collection of odd {@link Integer}s */ - private List collectionOdd = null; + private List collectionOdd; private final Collection emptyCollection = new ArrayList<>(1); - private Iterable iterableA = null; + private Iterable iterableA; /** * Creates a NodeList containing the specified nodes. diff --git a/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecoratorTest.java b/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecoratorTest.java index 48048b1342..644b42f0cb 100644 --- a/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecoratorTest.java +++ b/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecoratorTest.java @@ -67,7 +67,7 @@ public boolean isSetValueSupported() { */ private static final class TestOrderedBidiMap extends AbstractOrderedBidiMapDecorator { - private TestOrderedBidiMap inverse = null; + private TestOrderedBidiMap inverse; TestOrderedBidiMap() { super(new DualTreeBidiMap<>()); diff --git a/src/test/java/org/apache/commons/collections4/iterators/CollatingIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/CollatingIteratorTest.java index a1a112830a..bfc30467e0 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/CollatingIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/CollatingIteratorTest.java @@ -45,10 +45,10 @@ public CollatingIteratorTest() { //--------------------------------------------------------------- Lifecycle - private Comparator comparator = null; - private ArrayList evens = null; - private ArrayList odds = null; - private ArrayList fib = null; + private Comparator comparator; + private ArrayList evens; + private ArrayList odds; + private ArrayList fib; @BeforeEach public void setUp() throws Exception { diff --git a/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java index 9ac73be842..7181bf4b36 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java @@ -39,18 +39,18 @@ @SuppressWarnings("boxing") public class FilterListIteratorTest { - private ArrayList list = null; - private ArrayList odds = null; - private ArrayList evens = null; - private ArrayList threes = null; - private ArrayList fours = null; - private ArrayList sixes = null; - private Predicate truePred = null; - private Predicate falsePred = null; - private Predicate evenPred = null; - private Predicate oddPred = null; - private Predicate threePred = null; - private Predicate fourPred = null; + private ArrayList list; + private ArrayList odds; + private ArrayList evens; + private ArrayList threes; + private ArrayList fours; + private ArrayList sixes; + private Predicate truePred; + private Predicate falsePred; + private Predicate evenPred; + private Predicate oddPred; + private Predicate threePred; + private Predicate fourPred; private final Random random = new Random(); @BeforeEach diff --git a/src/test/java/org/apache/commons/collections4/iterators/IteratorChainTest.java b/src/test/java/org/apache/commons/collections4/iterators/IteratorChainTest.java index 3f1e42a85c..88e33542bb 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/IteratorChainTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/IteratorChainTest.java @@ -41,9 +41,9 @@ public class IteratorChainTest extends AbstractIteratorTest { "One", "Two", "Three", "Four", "Five", "Six" }; - protected List list1 = null; - protected List list2 = null; - protected List list3 = null; + protected List list1; + protected List list2; + protected List list3; public IteratorChainTest() { super(IteratorChainTest.class.getSimpleName()); diff --git a/src/test/java/org/apache/commons/collections4/iterators/LazyIteratorChainTest.java b/src/test/java/org/apache/commons/collections4/iterators/LazyIteratorChainTest.java index ff1a8e454a..1f97d27f08 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/LazyIteratorChainTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/LazyIteratorChainTest.java @@ -41,9 +41,9 @@ public class LazyIteratorChainTest extends AbstractIteratorTest { "One", "Two", "Three", "Four", "Five", "Six" }; - protected List list1 = null; - protected List list2 = null; - protected List list3 = null; + protected List list1; + protected List list2; + protected List list3; public LazyIteratorChainTest() { super(LazyIteratorChainTest.class.getSimpleName()); diff --git a/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapper2Test.java b/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapper2Test.java index c931246452..6fd8f115c8 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapper2Test.java +++ b/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapper2Test.java @@ -38,7 +38,7 @@ public class ListIteratorWrapper2Test extends AbstractIteratorTest { "One", "Two", "Three", "Four", "Five", "Six" }; - protected List list1 = null; + protected List list1; public ListIteratorWrapper2Test() { super(ListIteratorWrapper2Test.class.getSimpleName()); diff --git a/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapperTest.java b/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapperTest.java index 97c5a589eb..2d41458fed 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapperTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapperTest.java @@ -39,7 +39,7 @@ public class ListIteratorWrapperTest extends AbstractIteratorTest { "One", "Two", "Three", "Four", "Five", "Six" }; - protected List list1 = null; + protected List list1; public ListIteratorWrapperTest() { super(ListIteratorWrapperTest.class.getSimpleName()); diff --git a/src/test/java/org/apache/commons/collections4/iterators/ObjectGraphIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/ObjectGraphIteratorTest.java index b01021b96f..7befde8a58 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/ObjectGraphIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/ObjectGraphIteratorTest.java @@ -39,10 +39,10 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest { protected String[] testArray = { "One", "Two", "Three", "Four", "Five", "Six" }; - protected List list1 = null; - protected List list2 = null; - protected List list3 = null; - protected List> iteratorList = null; + protected List list1; + protected List list2; + protected List list3; + protected List> iteratorList; public ObjectGraphIteratorTest() { super(ObjectGraphIteratorTest.class.getSimpleName()); diff --git a/src/test/java/org/apache/commons/collections4/iterators/UniqueFilterIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/UniqueFilterIteratorTest.java index a5e2180ae3..9ae28ca38b 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/UniqueFilterIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/UniqueFilterIteratorTest.java @@ -36,7 +36,7 @@ public class UniqueFilterIteratorTest extends AbstractIteratorTest { "One", "Two", "Three", "Four", "Five", "Six" }; - protected List list1 = null; + protected List list1; public UniqueFilterIteratorTest() { super(UniqueFilterIteratorTest.class.getSimpleName()); diff --git a/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java index 899be2bb8c..4c7e2e34be 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java @@ -40,9 +40,9 @@ public ZippingIteratorTest() { //--------------------------------------------------------------- Lifecycle - private ArrayList evens = null; - private ArrayList odds = null; - private ArrayList fib = null; + private ArrayList evens; + private ArrayList odds; + private ArrayList fib; @BeforeEach public void setUp() throws Exception { diff --git a/src/test/java/org/apache/commons/collections4/set/UnmodifiableNavigableSetTest.java b/src/test/java/org/apache/commons/collections4/set/UnmodifiableNavigableSetTest.java index 2b5c7812a9..c628025920 100644 --- a/src/test/java/org/apache/commons/collections4/set/UnmodifiableNavigableSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/UnmodifiableNavigableSetTest.java @@ -36,8 +36,8 @@ * @since 4.1 */ public class UnmodifiableNavigableSetTest extends AbstractNavigableSetTest { - protected UnmodifiableNavigableSet set = null; - protected ArrayList array = null; + protected UnmodifiableNavigableSet set; + protected ArrayList array; public UnmodifiableNavigableSetTest() { super(UnmodifiableNavigableSetTest.class.getSimpleName()); diff --git a/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java b/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java index 258e210977..574cb4292d 100644 --- a/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java @@ -37,8 +37,8 @@ * @since 3.0 */ public class UnmodifiableSortedSetTest extends AbstractSortedSetTest { - protected UnmodifiableSortedSet set = null; - protected ArrayList array = null; + protected UnmodifiableSortedSet set; + protected ArrayList array; public UnmodifiableSortedSetTest() { super(UnmodifiableSortedSetTest.class.getSimpleName());