Skip to content

Commit

Permalink
Make private class final
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Nov 5, 2023
1 parent 07967af commit c900429
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public List<E> subList(final int fromIndex, final int toIndex) {
/**
* List iterator that only permits changes via set()
*/
private class FixedSizeListIterator extends AbstractListIteratorDecorator<E> {
private final class FixedSizeListIterator extends AbstractListIteratorDecorator<E> {
protected FixedSizeListIterator(final ListIterator<E> iterator) {
super(iterator);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public Set<Map.Entry<K, V>> entrySet() {
/**
* Implementation of an entry set that checks additions via setValue.
*/
private class EntrySet extends AbstractSetDecorator<Map.Entry<K, V>> {
private final class EntrySet extends AbstractSetDecorator<Map.Entry<K, V>> {

/** Generated serial version ID. */
private static final long serialVersionUID = 4354731610923110264L;
Expand Down Expand Up @@ -166,7 +166,7 @@ public <T> T[] toArray(final T[] array) {
/**
* Implementation of an entry set iterator that checks additions via setValue.
*/
private class EntrySetIterator extends AbstractIteratorDecorator<Map.Entry<K, V>> {
private final class EntrySetIterator extends AbstractIteratorDecorator<Map.Entry<K, V>> {

/** The parent map */
private final AbstractInputCheckedMapDecorator<K, V> parent;
Expand All @@ -187,7 +187,7 @@ public Map.Entry<K, V> next() {
/**
* Implementation of a map entry that checks additions via setValue.
*/
private class MapEntry extends AbstractMapEntryDecorator<K, V> {
private final class MapEntry extends AbstractMapEntryDecorator<K, V> {

/** The parent map */
private final AbstractInputCheckedMapDecorator<K, V> parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ protected Collection<V> createCollection(final int size) {
/**
* Inner class that provides the values view.
*/
private class Values extends AbstractCollection<V> {
private final class Values extends AbstractCollection<V> {
@Override
public Iterator<V> iterator() {
final IteratorChain<V> chain = new IteratorChain<>();
Expand All @@ -508,7 +508,7 @@ public void clear() {
/**
* Inner class that provides the values iterator.
*/
private class ValuesIterator implements Iterator<V> {
private final class ValuesIterator implements Iterator<V> {
private final Object key;
private final Collection<V> values;
private final Iterator<V> iterator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ private static final class Lock {
public int size;
}

private class BaseIterator {
class BaseIterator {
private final ArrayList<Map.Entry<K, V>> current = new ArrayList<>();
private int bucket;
private Map.Entry<K, V> last;
Expand Down Expand Up @@ -540,7 +540,7 @@ public void remove() {
}
}

private class EntryIterator extends BaseIterator implements Iterator<Map.Entry<K, V>> {
private final class EntryIterator extends BaseIterator implements Iterator<Map.Entry<K, V>> {

@Override
public Map.Entry<K, V> next() {
Expand All @@ -549,7 +549,7 @@ public Map.Entry<K, V> next() {

}

private class ValueIterator extends BaseIterator implements Iterator<V> {
private final class ValueIterator extends BaseIterator implements Iterator<V> {

@Override
public V next() {
Expand All @@ -558,7 +558,7 @@ public V next() {

}

private class KeyIterator extends BaseIterator implements Iterator<K> {
private final class KeyIterator extends BaseIterator implements Iterator<K> {

@Override
public K next() {
Expand All @@ -567,7 +567,7 @@ public K next() {

}

private class EntrySet extends AbstractSet<Map.Entry<K, V>> {
private final class EntrySet extends AbstractSet<Map.Entry<K, V>> {

@Override
public int size() {
Expand Down Expand Up @@ -618,7 +618,7 @@ public boolean remove(final Object obj) {

}

private class KeySet extends AbstractSet<K> {
private final class KeySet extends AbstractSet<K> {

@Override
public int size() {
Expand Down Expand Up @@ -658,7 +658,7 @@ public boolean remove(final Object obj) {
}


private class Values extends AbstractCollection<V> {
private final class Values extends AbstractCollection<V> {

@Override
public int size() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public <T> T[] toArray(final T[] array) {
/**
* Implementation of an entry set iterator.
*/
private class UnmodifiableEntrySetIterator extends AbstractIteratorDecorator<Map.Entry<K, V>> {
private final class UnmodifiableEntrySetIterator extends AbstractIteratorDecorator<Map.Entry<K, V>> {

protected UnmodifiableEntrySetIterator(final Iterator<Map.Entry<K, V>> iterator) {
super(iterator);
Expand All @@ -175,7 +175,7 @@ public void remove() {
/**
* Implementation of a map entry that is unmodifiable.
*/
private class UnmodifiableEntry extends AbstractMapEntryDecorator<K, V> {
private final class UnmodifiableEntry extends AbstractMapEntryDecorator<K, V> {

protected UnmodifiableEntry(final Map.Entry<K, V> entry) {
super(entry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public List<V> 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<V> {
private final class WrappedList extends WrappedCollection implements List<V> {

WrappedList(final K key) {
super(key);
Expand Down Expand Up @@ -210,7 +210,7 @@ public int hashCode() {
}

/** Values ListIterator */
private class ValuesListIterator implements ListIterator<V> {
private final class ValuesListIterator implements ListIterator<V> {

private final K key;
private List<V> values;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ public String toString() {
/**
* Inner class that provides a MultiSet<K> keys view.
*/
private class KeysMultiSet extends AbstractMultiSet<K> {
private final class KeysMultiSet extends AbstractMultiSet<K> {

@Override
public boolean contains(final Object o) {
Expand Down Expand Up @@ -598,7 +598,7 @@ public int getCount() {
/**
* Inner class that provides the Entry<K, V> view
*/
private class EntryValues extends AbstractCollection<Entry<K, V>> {
private final class EntryValues extends AbstractCollection<Entry<K, V>> {

@Override
public Iterator<Entry<K, V>> iterator() {
Expand Down Expand Up @@ -629,7 +629,7 @@ public int size() {
/**
* Inner class for MultiValuedMap Entries.
*/
private class MultiValuedMapEntry extends AbstractMapEntry<K, V> {
private final class MultiValuedMapEntry extends AbstractMapEntry<K, V> {

MultiValuedMapEntry(final K key, final V value) {
super(key, value);
Expand All @@ -645,7 +645,7 @@ public V setValue(final V value) {
/**
* Inner class for MapIterator.
*/
private class MultiValuedMapIterator implements MapIterator<K, V> {
private final class MultiValuedMapIterator implements MapIterator<K, V> {

private final Iterator<Entry<K, V>> it;

Expand Down Expand Up @@ -700,7 +700,7 @@ public V setValue(final V value) {
/**
* Inner class that provides the values view.
*/
private class Values extends AbstractCollection<V> {
private final class Values extends AbstractCollection<V> {
@Override
public Iterator<V> iterator() {
final IteratorChain<V> chain = new IteratorChain<>();
Expand All @@ -724,7 +724,7 @@ public void clear() {
/**
* Inner class that provides the values iterator.
*/
private class ValuesIterator implements Iterator<V> {
private final class ValuesIterator implements Iterator<V> {
private final Object key;
private final Collection<V> values;
private final Iterator<V> iterator;
Expand Down Expand Up @@ -757,7 +757,7 @@ public V next() {
/**
* Inner class that provides the AsMap view.
*/
private class AsMap extends AbstractMap<K, Collection<V>> {
private final class AsMap extends AbstractMap<K, Collection<V>> {
final transient Map<K, Collection<V>> decoratedMap;

AsMap(final Map<K, Collection<V>> map) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public Set<V> 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<V> {
private final class WrappedSet extends WrappedCollection implements Set<V> {

WrappedSet(final K key) {
super(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Map.Entry<K, V>> {
private final class EntrySet extends AbstractSet<Map.Entry<K, V>> {

@Override
public Iterator<Map.Entry<K, V>> iterator() {
Expand Down Expand Up @@ -1434,7 +1434,7 @@ public void clear() {
/**
* An {@link Iterator} that returns {@link Entry} Objects.
*/
private class EntryIterator extends AbstractTrieIterator<Map.Entry<K, V>> {
private final class EntryIterator extends AbstractTrieIterator<Map.Entry<K, V>> {
@Override
public Map.Entry<K, V> next() {
return nextEntry();
Expand All @@ -1445,7 +1445,7 @@ public Map.Entry<K, V> 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<K> {
private final class KeySet extends AbstractSet<K> {

@Override
public Iterator<K> iterator() {
Expand Down Expand Up @@ -1477,7 +1477,7 @@ public void clear() {
/**
* An {@link Iterator} that returns Key Objects.
*/
private class KeyIterator extends AbstractTrieIterator<K> {
private final class KeyIterator extends AbstractTrieIterator<K> {
@Override
public K next() {
return nextEntry().getKey();
Expand All @@ -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<V> {
private final class Values extends AbstractCollection<V> {

@Override
public Iterator<V> iterator() {
Expand Down Expand Up @@ -1525,7 +1525,7 @@ public boolean remove(final Object o) {
/**
* An {@link Iterator} that returns Value Objects.
*/
private class ValueIterator extends AbstractTrieIterator<V> {
private final class ValueIterator extends AbstractTrieIterator<V> {
@Override
public V next() {
return nextEntry().getValue();
Expand Down Expand Up @@ -1609,7 +1609,7 @@ public void remove() {
/**
* An {@link OrderedMapIterator} for a {@link org.apache.commons.collections4.Trie}.
*/
private class TrieMapIterator extends AbstractTrieIterator<K> implements OrderedMapIterator<K, V> {
private final class TrieMapIterator extends AbstractTrieIterator<K> implements OrderedMapIterator<K, V> {

protected TrieEntry<K, V> previous; // the previous node to return

Expand Down Expand Up @@ -1846,7 +1846,7 @@ protected abstract SortedMap<K, V> 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;
Expand Down Expand Up @@ -2088,7 +2088,7 @@ public Map.Entry<K, V> 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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*/
public class PredicatedSortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {

private class ReverseStringComparator implements Comparator<K> {
private final class ReverseStringComparator implements Comparator<K> {
@Override
public int compare(final K arg0, final K arg1) {
return ((String) arg1).compareTo((String) arg0);
Expand Down

0 comments on commit c900429

Please sign in to comment.