diff --git a/src/main/java/org/apache/commons/collections4/list/FixedSizeList.java b/src/main/java/org/apache/commons/collections4/list/FixedSizeList.java index 0006b15164..bd4c7de31d 100644 --- a/src/main/java/org/apache/commons/collections4/list/FixedSizeList.java +++ b/src/main/java/org/apache/commons/collections4/list/FixedSizeList.java @@ -172,7 +172,7 @@ public List subList(final int fromIndex, final int toIndex) { /** * List iterator that only permits changes via set() */ - private class FixedSizeListIterator extends AbstractListIteratorDecorator { + private final class FixedSizeListIterator extends AbstractListIteratorDecorator { protected FixedSizeListIterator(final ListIterator iterator) { super(iterator); } diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java b/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java index e568535545..3a76ecbbb7 100644 --- a/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java +++ b/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java @@ -107,7 +107,7 @@ public Set> entrySet() { /** * Implementation of an entry set that checks additions via setValue. */ - private class EntrySet extends AbstractSetDecorator> { + private final class EntrySet extends AbstractSetDecorator> { /** Generated serial version ID. */ private static final long serialVersionUID = 4354731610923110264L; @@ -166,7 +166,7 @@ public T[] toArray(final T[] array) { /** * Implementation of an entry set iterator that checks additions via setValue. */ - private class EntrySetIterator extends AbstractIteratorDecorator> { + private final class EntrySetIterator extends AbstractIteratorDecorator> { /** The parent map */ private final AbstractInputCheckedMapDecorator parent; @@ -187,7 +187,7 @@ public Map.Entry next() { /** * Implementation of a map entry that checks additions via setValue. */ - private class MapEntry extends AbstractMapEntryDecorator { + private final class MapEntry extends AbstractMapEntryDecorator { /** The parent map */ private final AbstractInputCheckedMapDecorator parent; diff --git a/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java b/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java index ed2474ae8f..c70fdaa904 100644 --- a/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java +++ b/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java @@ -484,7 +484,7 @@ protected Collection createCollection(final int size) { /** * Inner class that provides the values view. */ - private class Values extends AbstractCollection { + private final class Values extends AbstractCollection { @Override public Iterator iterator() { final IteratorChain chain = new IteratorChain<>(); @@ -508,7 +508,7 @@ public void clear() { /** * Inner class that provides the values iterator. */ - private class ValuesIterator implements Iterator { + private final class ValuesIterator implements Iterator { private final Object key; private final Collection values; private final Iterator iterator; diff --git a/src/main/java/org/apache/commons/collections4/map/StaticBucketMap.java b/src/main/java/org/apache/commons/collections4/map/StaticBucketMap.java index e9975e5215..2f6bb707e0 100644 --- a/src/main/java/org/apache/commons/collections4/map/StaticBucketMap.java +++ b/src/main/java/org/apache/commons/collections4/map/StaticBucketMap.java @@ -498,7 +498,7 @@ private static final class Lock { public int size; } - private class BaseIterator { + class BaseIterator { private final ArrayList> current = new ArrayList<>(); private int bucket; private Map.Entry last; @@ -540,7 +540,7 @@ public void remove() { } } - private class EntryIterator extends BaseIterator implements Iterator> { + private final class EntryIterator extends BaseIterator implements Iterator> { @Override public Map.Entry next() { @@ -549,7 +549,7 @@ public Map.Entry next() { } - private class ValueIterator extends BaseIterator implements Iterator { + private final class ValueIterator extends BaseIterator implements Iterator { @Override public V next() { @@ -558,7 +558,7 @@ public V next() { } - private class KeyIterator extends BaseIterator implements Iterator { + private final class KeyIterator extends BaseIterator implements Iterator { @Override public K next() { @@ -567,7 +567,7 @@ public K next() { } - private class EntrySet extends AbstractSet> { + private final class EntrySet extends AbstractSet> { @Override public int size() { @@ -618,7 +618,7 @@ public boolean remove(final Object obj) { } - private class KeySet extends AbstractSet { + private final class KeySet extends AbstractSet { @Override public int size() { @@ -658,7 +658,7 @@ public boolean remove(final Object obj) { } - private class Values extends AbstractCollection { + private final class Values extends AbstractCollection { @Override public int size() { diff --git a/src/main/java/org/apache/commons/collections4/map/UnmodifiableEntrySet.java b/src/main/java/org/apache/commons/collections4/map/UnmodifiableEntrySet.java index 89a52dd67f..57b434ce4a 100644 --- a/src/main/java/org/apache/commons/collections4/map/UnmodifiableEntrySet.java +++ b/src/main/java/org/apache/commons/collections4/map/UnmodifiableEntrySet.java @@ -155,7 +155,7 @@ public T[] toArray(final T[] array) { /** * Implementation of an entry set iterator. */ - private class UnmodifiableEntrySetIterator extends AbstractIteratorDecorator> { + private final class UnmodifiableEntrySetIterator extends AbstractIteratorDecorator> { protected UnmodifiableEntrySetIterator(final Iterator> iterator) { super(iterator); @@ -175,7 +175,7 @@ public void remove() { /** * Implementation of a map entry that is unmodifiable. */ - private class UnmodifiableEntry extends AbstractMapEntryDecorator { + private final class UnmodifiableEntry extends AbstractMapEntryDecorator { protected UnmodifiableEntry(final Map.Entry entry) { super(entry); diff --git a/src/main/java/org/apache/commons/collections4/multimap/AbstractListValuedMap.java b/src/main/java/org/apache/commons/collections4/multimap/AbstractListValuedMap.java index 89855e17db..03c2f80103 100644 --- a/src/main/java/org/apache/commons/collections4/multimap/AbstractListValuedMap.java +++ b/src/main/java/org/apache/commons/collections4/multimap/AbstractListValuedMap.java @@ -103,7 +103,7 @@ public List remove(final Object key) { /** * Wrapped list to handle add and remove on the list returned by get(object) */ - private class WrappedList extends WrappedCollection implements List { + private final class WrappedList extends WrappedCollection implements List { WrappedList(final K key) { super(key); @@ -210,7 +210,7 @@ public int hashCode() { } /** Values ListIterator */ - private class ValuesListIterator implements ListIterator { + private final class ValuesListIterator implements ListIterator { private final K key; private List values; diff --git a/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java b/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java index 215e1ddcd9..3749808272 100644 --- a/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java +++ b/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java @@ -538,7 +538,7 @@ public String toString() { /** * Inner class that provides a MultiSet keys view. */ - private class KeysMultiSet extends AbstractMultiSet { + private final class KeysMultiSet extends AbstractMultiSet { @Override public boolean contains(final Object o) { @@ -598,7 +598,7 @@ public int getCount() { /** * Inner class that provides the Entry view */ - private class EntryValues extends AbstractCollection> { + private final class EntryValues extends AbstractCollection> { @Override public Iterator> iterator() { @@ -629,7 +629,7 @@ public int size() { /** * Inner class for MultiValuedMap Entries. */ - private class MultiValuedMapEntry extends AbstractMapEntry { + private final class MultiValuedMapEntry extends AbstractMapEntry { MultiValuedMapEntry(final K key, final V value) { super(key, value); @@ -645,7 +645,7 @@ public V setValue(final V value) { /** * Inner class for MapIterator. */ - private class MultiValuedMapIterator implements MapIterator { + private final class MultiValuedMapIterator implements MapIterator { private final Iterator> it; @@ -700,7 +700,7 @@ public V setValue(final V value) { /** * Inner class that provides the values view. */ - private class Values extends AbstractCollection { + private final class Values extends AbstractCollection { @Override public Iterator iterator() { final IteratorChain chain = new IteratorChain<>(); @@ -724,7 +724,7 @@ public void clear() { /** * Inner class that provides the values iterator. */ - private class ValuesIterator implements Iterator { + private final class ValuesIterator implements Iterator { private final Object key; private final Collection values; private final Iterator iterator; @@ -757,7 +757,7 @@ public V next() { /** * Inner class that provides the AsMap view. */ - private class AsMap extends AbstractMap> { + private final class AsMap extends AbstractMap> { final transient Map> decoratedMap; AsMap(final Map> map) { diff --git a/src/main/java/org/apache/commons/collections4/multimap/AbstractSetValuedMap.java b/src/main/java/org/apache/commons/collections4/multimap/AbstractSetValuedMap.java index 64745cedbe..c4a4dea106 100644 --- a/src/main/java/org/apache/commons/collections4/multimap/AbstractSetValuedMap.java +++ b/src/main/java/org/apache/commons/collections4/multimap/AbstractSetValuedMap.java @@ -103,7 +103,7 @@ public Set remove(final Object key) { * Wrapped set to handle add and remove on the collection returned by * {@code get(Object)}. */ - private class WrappedSet extends WrappedCollection implements Set { + private final class WrappedSet extends WrappedCollection implements Set { WrappedSet(final K key) { super(key); diff --git a/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java b/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java index 35ab7fb984..62ab39f4fb 100644 --- a/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java +++ b/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java @@ -1391,7 +1391,7 @@ public String toString() { /** * This is an entry set view of the {@link org.apache.commons.collections4.Trie} as returned by {@link Map#entrySet()}. */ - private class EntrySet extends AbstractSet> { + private final class EntrySet extends AbstractSet> { @Override public Iterator> iterator() { @@ -1434,7 +1434,7 @@ public void clear() { /** * An {@link Iterator} that returns {@link Entry} Objects. */ - private class EntryIterator extends AbstractTrieIterator> { + private final class EntryIterator extends AbstractTrieIterator> { @Override public Map.Entry next() { return nextEntry(); @@ -1445,7 +1445,7 @@ public Map.Entry next() { /** * This is a key set view of the {@link org.apache.commons.collections4.Trie} as returned by {@link Map#keySet()}. */ - private class KeySet extends AbstractSet { + private final class KeySet extends AbstractSet { @Override public Iterator iterator() { @@ -1477,7 +1477,7 @@ public void clear() { /** * An {@link Iterator} that returns Key Objects. */ - private class KeyIterator extends AbstractTrieIterator { + private final class KeyIterator extends AbstractTrieIterator { @Override public K next() { return nextEntry().getKey(); @@ -1488,7 +1488,7 @@ public K next() { /** * This is a value view of the {@link org.apache.commons.collections4.Trie} as returned by {@link Map#values()}. */ - private class Values extends AbstractCollection { + private final class Values extends AbstractCollection { @Override public Iterator iterator() { @@ -1525,7 +1525,7 @@ public boolean remove(final Object o) { /** * An {@link Iterator} that returns Value Objects. */ - private class ValueIterator extends AbstractTrieIterator { + private final class ValueIterator extends AbstractTrieIterator { @Override public V next() { return nextEntry().getValue(); @@ -1609,7 +1609,7 @@ public void remove() { /** * An {@link OrderedMapIterator} for a {@link org.apache.commons.collections4.Trie}. */ - private class TrieMapIterator extends AbstractTrieIterator implements OrderedMapIterator { + private final class TrieMapIterator extends AbstractTrieIterator implements OrderedMapIterator { protected TrieEntry previous; // the previous node to return @@ -1846,7 +1846,7 @@ protected abstract SortedMap createRangeMap(K fromKey, boolean fromInclusi /** * A {@link AbstractRangeMap} that deals with {@link Entry}s. */ - private class RangeEntryMap extends AbstractRangeMap { + private final class RangeEntryMap extends AbstractRangeMap { /** The key to start from, null if the beginning. */ private final K fromKey; @@ -2088,7 +2088,7 @@ public Map.Entry next() { /** * A submap used for prefix views over the {@link org.apache.commons.collections4.Trie}. */ - private class PrefixRangeMap extends AbstractRangeMap { + private final class PrefixRangeMap extends AbstractRangeMap { private final K prefix; diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/ArrayHasher.java b/src/test/java/org/apache/commons/collections4/bloomfilter/ArrayHasher.java index 753decc6e2..348cf912aa 100644 --- a/src/test/java/org/apache/commons/collections4/bloomfilter/ArrayHasher.java +++ b/src/test/java/org/apache/commons/collections4/bloomfilter/ArrayHasher.java @@ -37,7 +37,7 @@ public IndexProducer indices(final Shape shape) { return new Producer(shape); } - private class Producer implements IndexProducer { + private final class Producer implements IndexProducer { Shape shape; Producer(final Shape shape) { 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 dfb6c95432..7ce0d4409c 100644 --- a/src/test/java/org/apache/commons/collections4/map/PredicatedSortedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/PredicatedSortedMapTest.java @@ -43,7 +43,7 @@ */ public class PredicatedSortedMapTest extends AbstractSortedMapTest { - private class ReverseStringComparator implements Comparator { + private final class ReverseStringComparator implements Comparator { @Override public int compare(final K arg0, final K arg1) { return ((String) arg1).compareTo((String) arg0);