From c788e536a964bfc6112df6f2ae204a93dc25e820 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 25 Aug 2024 16:18:24 -0400 Subject: [PATCH] Remove redundant keywords --- .../commons/collections4/FluentIterable.java | 2 +- .../commons/collections4/SplitMapUtils.java | 4 +- .../bloomfilter/ArrayCountingBloomFilter.java | 2 +- .../bloomfilter/LayerManager.java | 4 +- .../bloomfilter/SparseBloomFilter.java | 10 +-- .../comparators/BooleanComparator.java | 2 +- .../comparators/NullComparator.java | 10 +-- .../comparators/TransformingComparator.java | 6 +- .../collections4/iterators/ArrayIterator.java | 6 +- .../iterators/ArrayListIterator.java | 20 +++--- .../iterators/ObjectArrayIterator.java | 18 +++--- .../iterators/ObjectArrayListIterator.java | 20 +++--- .../map/AbstractReferenceMap.java | 14 ++-- .../collections4/map/CompositeMap.java | 64 +++++++++---------- .../collections4/map/ListOrderedMap.java | 26 ++++---- .../multimap/AbstractListValuedMap.java | 6 +- .../collections4/set/CompositeSet.java | 2 +- .../collections4/map/AbstractMapTest.java | 12 ++-- .../collections4/map/CompositeMapTest.java | 2 +- .../multimap/AbstractMultiValuedMapTest.java | 8 +-- 20 files changed, 119 insertions(+), 119 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/FluentIterable.java b/src/main/java/org/apache/commons/collections4/FluentIterable.java index 4a7054eb4..d3b07b88a 100644 --- a/src/main/java/org/apache/commons/collections4/FluentIterable.java +++ b/src/main/java/org/apache/commons/collections4/FluentIterable.java @@ -131,7 +131,7 @@ public class FluentIterable implements Iterable { * Don't allow instances. */ FluentIterable() { - this.iterable = this; + iterable = this; } /** diff --git a/src/main/java/org/apache/commons/collections4/SplitMapUtils.java b/src/main/java/org/apache/commons/collections4/SplitMapUtils.java index b645d3049..bcaca1a53 100644 --- a/src/main/java/org/apache/commons/collections4/SplitMapUtils.java +++ b/src/main/java/org/apache/commons/collections4/SplitMapUtils.java @@ -70,7 +70,7 @@ public class SplitMapUtils { if (arg0 == this) { return true; } - return arg0 instanceof WrappedGet && ((WrappedGet) arg0).get.equals(this.get); + return arg0 instanceof WrappedGet && ((WrappedGet) arg0).get.equals(get); } @Override @@ -162,7 +162,7 @@ public class SplitMapUtils { if (obj == this) { return true; } - return obj instanceof WrappedPut && ((WrappedPut) obj).put.equals(this.put); + return obj instanceof WrappedPut && ((WrappedPut) obj).put.equals(put); } @Override 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 f5fc946a5..dc029d231 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java @@ -157,7 +157,7 @@ public final class ArrayCountingBloomFilter implements CountingBloomFilter { @Override public boolean contains(final IndexExtractor indexExtractor) { - return indexExtractor.processIndices(idx -> this.cells[idx] != 0); + return indexExtractor.processIndices(idx -> cells[idx] != 0); } @Override diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/LayerManager.java b/src/main/java/org/apache/commons/collections4/bloomfilter/LayerManager.java index 574a92cfb..2755a0ba0 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/LayerManager.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/LayerManager.java @@ -326,7 +326,7 @@ public class LayerManager implements BloomFilterExtractor * @see LayerManager.Builder#setCleanup(Consumer) */ void cleanup() { - this.filterCleanup.accept(filters); + filterCleanup.accept(filters); if (filters.isEmpty()) { addFilter(); } @@ -429,7 +429,7 @@ public class LayerManager implements BloomFilterExtractor * @see LayerManager.Builder#setCleanup(Consumer) */ void next() { - this.filterCleanup.accept(filters); + filterCleanup.accept(filters); addFilter(); } diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/SparseBloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/SparseBloomFilter.java index 78b415fa8..746d86089 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/SparseBloomFilter.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/SparseBloomFilter.java @@ -138,14 +138,14 @@ public final class SparseBloomFilter implements BloomFilter { public boolean merge(final IndexExtractor indexExtractor) { Objects.requireNonNull(indexExtractor, "indexExtractor"); indexExtractor.processIndices(this::add); - if (!this.indices.isEmpty()) { - if (this.indices.last() >= shape.getNumberOfBits()) { + if (!indices.isEmpty()) { + if (indices.last() >= shape.getNumberOfBits()) { throw new IllegalArgumentException(String.format("Value in list %s is greater than maximum value (%s)", - this.indices.last(), shape.getNumberOfBits() - 1)); + indices.last(), shape.getNumberOfBits() - 1)); } - if (this.indices.first() < 0) { + if (indices.first() < 0) { throw new IllegalArgumentException( - String.format("Value in list %s is less than 0", this.indices.first())); + String.format("Value in list %s is less than 0", indices.first())); } } return true; diff --git a/src/main/java/org/apache/commons/collections4/comparators/BooleanComparator.java b/src/main/java/org/apache/commons/collections4/comparators/BooleanComparator.java index 6df3e1ed2..749456d44 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/BooleanComparator.java +++ b/src/main/java/org/apache/commons/collections4/comparators/BooleanComparator.java @@ -157,7 +157,7 @@ public final class BooleanComparator implements Comparator, Serializabl public boolean equals(final Object object) { return this == object || object instanceof BooleanComparator && - this.trueFirst == ((BooleanComparator) object).trueFirst; + trueFirst == ((BooleanComparator) object).trueFirst; } /** diff --git a/src/main/java/org/apache/commons/collections4/comparators/NullComparator.java b/src/main/java/org/apache/commons/collections4/comparators/NullComparator.java index 3530959d3..8db6b07b7 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/NullComparator.java +++ b/src/main/java/org/apache/commons/collections4/comparators/NullComparator.java @@ -134,12 +134,12 @@ public class NullComparator implements Comparator, Serializable { return 0; } if (o1 == null) { - return this.nullsAreHigh ? 1 : -1; + return nullsAreHigh ? 1 : -1; } if (o2 == null) { - return this.nullsAreHigh ? -1 : 1; + return nullsAreHigh ? -1 : 1; } - return this.nonNullComparator.compare(o1, o2); + return nonNullComparator.compare(o1, o2); } /** @@ -167,8 +167,8 @@ public class NullComparator implements Comparator, Serializable { final NullComparator other = (NullComparator) obj; - return this.nullsAreHigh == other.nullsAreHigh && - this.nonNullComparator.equals(other.nonNullComparator); + return nullsAreHigh == other.nullsAreHigh && + nonNullComparator.equals(other.nonNullComparator); } /** diff --git a/src/main/java/org/apache/commons/collections4/comparators/TransformingComparator.java b/src/main/java/org/apache/commons/collections4/comparators/TransformingComparator.java index 5d6b18027..989334022 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/TransformingComparator.java +++ b/src/main/java/org/apache/commons/collections4/comparators/TransformingComparator.java @@ -81,9 +81,9 @@ public class TransformingComparator implements Comparator, Serializable */ @Override public int compare(final I obj1, final I obj2) { - final O value1 = this.transformer.apply(obj1); - final O value2 = this.transformer.apply(obj2); - return this.decorated.compare(value1, value2); + final O value1 = transformer.apply(obj1); + final O value2 = transformer.apply(obj2); + return decorated.compare(value1, value2); } /** diff --git a/src/main/java/org/apache/commons/collections4/iterators/ArrayIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ArrayIterator.java index 393e63b81..c0f7bfd4d 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ArrayIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ArrayIterator.java @@ -137,7 +137,7 @@ public class ArrayIterator implements ResettableIterator { * @since 4.0 */ public int getEndIndex() { - return this.endIndex; + return endIndex; } /** @@ -147,7 +147,7 @@ public class ArrayIterator implements ResettableIterator { * @since 4.0 */ public int getStartIndex() { - return this.startIndex; + return startIndex; } // Iterator interface @@ -192,7 +192,7 @@ public class ArrayIterator implements ResettableIterator { */ @Override public void reset() { - this.index = this.startIndex; + index = startIndex; } } diff --git a/src/main/java/org/apache/commons/collections4/iterators/ArrayListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ArrayListIterator.java index 260c236f1..ed0c80664 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ArrayListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ArrayListIterator.java @@ -113,7 +113,7 @@ public class ArrayListIterator extends ArrayIterator */ @Override public boolean hasPrevious() { - return this.index > this.startIndex; + return index > startIndex; } /** @@ -128,8 +128,8 @@ public class ArrayListIterator extends ArrayIterator if (!hasNext()) { throw new NoSuchElementException(); } - this.lastItemIndex = this.index; - return (E) Array.get(this.array, this.index++); + lastItemIndex = index; + return (E) Array.get(array, index++); } /** @@ -139,7 +139,7 @@ public class ArrayListIterator extends ArrayIterator */ @Override public int nextIndex() { - return this.index - this.startIndex; + return index - startIndex; } /** @@ -154,8 +154,8 @@ public class ArrayListIterator extends ArrayIterator if (!hasPrevious()) { throw new NoSuchElementException(); } - this.lastItemIndex = --this.index; - return (E) Array.get(this.array, this.index); + lastItemIndex = --index; + return (E) Array.get(array, index); } /** @@ -165,7 +165,7 @@ public class ArrayListIterator extends ArrayIterator */ @Override public int previousIndex() { - return this.index - this.startIndex - 1; + return index - startIndex - 1; } /** @@ -174,7 +174,7 @@ public class ArrayListIterator extends ArrayIterator @Override public void reset() { super.reset(); - this.lastItemIndex = -1; + lastItemIndex = -1; } /** @@ -197,11 +197,11 @@ public class ArrayListIterator extends ArrayIterator */ @Override public void set(final Object o) { - if (this.lastItemIndex == -1) { + if (lastItemIndex == -1) { throw new IllegalStateException("must call next() or previous() before a call to set()"); } - Array.set(this.array, this.lastItemIndex, o); + Array.set(array, lastItemIndex, o); } } diff --git a/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayIterator.java index 6f92abbb0..3a8b324a3 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayIterator.java @@ -92,9 +92,9 @@ public class ObjectArrayIterator implements ResettableIterator { throw new IllegalArgumentException("End index must not be less than start index"); } this.array = array; - this.startIndex = start; - this.endIndex = end; - this.index = start; + startIndex = start; + endIndex = end; + index = start; } /** @@ -103,7 +103,7 @@ public class ObjectArrayIterator implements ResettableIterator { * @return the array this iterator iterates over */ public E[] getArray() { - return this.array; + return array; } /** @@ -112,7 +112,7 @@ public class ObjectArrayIterator implements ResettableIterator { * @return the end index */ public int getEndIndex() { - return this.endIndex; + return endIndex; } /** @@ -121,7 +121,7 @@ public class ObjectArrayIterator implements ResettableIterator { * @return the start index */ public int getStartIndex() { - return this.startIndex; + return startIndex; } /** @@ -131,7 +131,7 @@ public class ObjectArrayIterator implements ResettableIterator { */ @Override public boolean hasNext() { - return this.index < this.endIndex; + return index < endIndex; } /** @@ -146,7 +146,7 @@ public class ObjectArrayIterator implements ResettableIterator { if (!hasNext()) { throw new NoSuchElementException(); } - return this.array[this.index++]; + return array[index++]; } /** @@ -164,7 +164,7 @@ public class ObjectArrayIterator implements ResettableIterator { */ @Override public void reset() { - this.index = this.startIndex; + index = startIndex; } } diff --git a/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayListIterator.java index 419b1825f..faafa5703 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayListIterator.java @@ -105,7 +105,7 @@ public class ObjectArrayListIterator extends ObjectArrayIterator */ @Override public boolean hasPrevious() { - return this.index > getStartIndex(); + return index > getStartIndex(); } /** @@ -119,8 +119,8 @@ public class ObjectArrayListIterator extends ObjectArrayIterator if (!hasNext()) { throw new NoSuchElementException(); } - this.lastItemIndex = this.index; - return this.array[this.index++]; + lastItemIndex = index; + return array[index++]; } /** @@ -130,7 +130,7 @@ public class ObjectArrayListIterator extends ObjectArrayIterator */ @Override public int nextIndex() { - return this.index - getStartIndex(); + return index - getStartIndex(); } /** @@ -144,8 +144,8 @@ public class ObjectArrayListIterator extends ObjectArrayIterator if (!hasPrevious()) { throw new NoSuchElementException(); } - this.lastItemIndex = --this.index; - return this.array[this.index]; + lastItemIndex = --index; + return array[index]; } /** @@ -155,7 +155,7 @@ public class ObjectArrayListIterator extends ObjectArrayIterator */ @Override public int previousIndex() { - return this.index - getStartIndex() - 1; + return index - getStartIndex() - 1; } /** @@ -164,7 +164,7 @@ public class ObjectArrayListIterator extends ObjectArrayIterator @Override public void reset() { super.reset(); - this.lastItemIndex = -1; + lastItemIndex = -1; } /** @@ -186,11 +186,11 @@ public class ObjectArrayListIterator extends ObjectArrayIterator */ @Override public void set(final E obj) { - if (this.lastItemIndex == -1) { + if (lastItemIndex == -1) { throw new IllegalStateException("must call next() or previous() before a call to set()"); } - this.array[this.lastItemIndex] = obj; + array[lastItemIndex] = obj; } } diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java index 632233495..0f926a474 100644 --- a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java +++ b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java @@ -797,10 +797,10 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap @Override @SuppressWarnings("unchecked") protected void doReadObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { - this.keyType = ReferenceStrength.resolve(in.readInt()); - this.valueType = ReferenceStrength.resolve(in.readInt()); - this.purgeValues = in.readBoolean(); - this.loadFactor = in.readFloat(); + keyType = ReferenceStrength.resolve(in.readInt()); + valueType = ReferenceStrength.resolve(in.readInt()); + purgeValues = in.readBoolean(); + loadFactor = in.readFloat(); final int capacity = in.readInt(); init(); data = new HashEntry[capacity]; @@ -958,7 +958,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap * @return true if keyType has the specified type */ protected boolean isKeyType(final ReferenceStrength type) { - return this.keyType == type; + return keyType == type; } /** @@ -967,7 +967,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap * @return true if valueType has the specified type */ protected boolean isValueType(final ReferenceStrength type) { - return this.valueType == type; + return valueType == type; } /** @@ -1031,7 +1031,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap } else { previous.next = entry.next; } - this.size--; + size--; refEntry.onPurge(); return; } diff --git a/src/main/java/org/apache/commons/collections4/map/CompositeMap.java b/src/main/java/org/apache/commons/collections4/map/CompositeMap.java index 5ad29f248..6cb79c067 100644 --- a/src/main/java/org/apache/commons/collections4/map/CompositeMap.java +++ b/src/main/java/org/apache/commons/collections4/map/CompositeMap.java @@ -193,17 +193,17 @@ public class CompositeMap extends AbstractIterableMap implements Ser public synchronized void addComposited(final Map map) throws IllegalArgumentException { if (map != null) { for (int i = composite.length - 1; i >= 0; --i) { - final Collection intersect = CollectionUtils.intersection(this.composite[i].keySet(), map.keySet()); + final Collection intersect = CollectionUtils.intersection(composite[i].keySet(), map.keySet()); if (!intersect.isEmpty()) { - if (this.mutator == null) { + if (mutator == null) { throw new IllegalArgumentException("Key collision adding Map to CompositeMap"); } - this.mutator.resolveCollision(this, this.composite[i], map, intersect); + mutator.resolveCollision(this, composite[i], map, intersect); } } - final Map[] temp = Arrays.copyOf(this.composite, this.composite.length + 1); + final Map[] temp = Arrays.copyOf(composite, composite.length + 1); temp[temp.length - 1] = map; - this.composite = temp; + composite = temp; } } @@ -214,8 +214,8 @@ public class CompositeMap extends AbstractIterableMap implements Ser */ @Override public void clear() { - for (int i = this.composite.length - 1; i >= 0; --i) { - this.composite[i].clear(); + for (int i = composite.length - 1; i >= 0; --i) { + composite[i].clear(); } } @@ -237,8 +237,8 @@ public class CompositeMap extends AbstractIterableMap implements Ser */ @Override public boolean containsKey(final Object key) { - for (int i = this.composite.length - 1; i >= 0; --i) { - if (this.composite[i].containsKey(key)) { + for (int i = composite.length - 1; i >= 0; --i) { + if (composite[i].containsKey(key)) { return true; } } @@ -263,8 +263,8 @@ public class CompositeMap extends AbstractIterableMap implements Ser */ @Override public boolean containsValue(final Object value) { - for (int i = this.composite.length - 1; i >= 0; --i) { - if (this.composite[i].containsValue(value)) { + for (int i = composite.length - 1; i >= 0; --i) { + if (composite[i].containsValue(value)) { return true; } } @@ -338,9 +338,9 @@ public class CompositeMap extends AbstractIterableMap implements Ser */ @Override public V get(final Object key) { - for (int i = this.composite.length - 1; i >= 0; --i) { - if (this.composite[i].containsKey(key)) { - return this.composite[i].get(key); + for (int i = composite.length - 1; i >= 0; --i) { + if (composite[i].containsKey(key)) { + return composite[i].get(key); } } return null; @@ -366,8 +366,8 @@ public class CompositeMap extends AbstractIterableMap implements Ser */ @Override public boolean isEmpty() { - for (int i = this.composite.length - 1; i >= 0; --i) { - if (!this.composite[i].isEmpty()) { + for (int i = composite.length - 1; i >= 0; --i) { + if (!composite[i].isEmpty()) { return false; } } @@ -392,8 +392,8 @@ public class CompositeMap extends AbstractIterableMap implements Ser @Override public Set keySet() { final CompositeSet keys = new CompositeSet<>(); - for (int i = this.composite.length - 1; i >= 0; --i) { - keys.addComposited(this.composite[i].keySet()); + for (int i = composite.length - 1; i >= 0; --i) { + keys.addComposited(composite[i].keySet()); } return keys; } @@ -425,10 +425,10 @@ public class CompositeMap extends AbstractIterableMap implements Ser */ @Override public V put(final K key, final V value) { - if (this.mutator == null) { + if (mutator == null) { throw new UnsupportedOperationException("No mutator specified"); } - return this.mutator.put(this, this.composite, key, value); + return mutator.put(this, composite, key, value); } /** @@ -455,10 +455,10 @@ public class CompositeMap extends AbstractIterableMap implements Ser */ @Override public void putAll(final Map map) { - if (this.mutator == null) { + if (mutator == null) { throw new UnsupportedOperationException("No mutator specified"); } - this.mutator.putAll(this, this.composite, map); + mutator.putAll(this, composite, map); } /** @@ -488,9 +488,9 @@ public class CompositeMap extends AbstractIterableMap implements Ser */ @Override public V remove(final Object key) { - for (int i = this.composite.length - 1; i >= 0; --i) { - if (this.composite[i].containsKey(key)) { - return this.composite[i].remove(key); + for (int i = composite.length - 1; i >= 0; --i) { + if (composite[i].containsKey(key)) { + return composite[i].remove(key); } } return null; @@ -504,13 +504,13 @@ public class CompositeMap extends AbstractIterableMap implements Ser */ @SuppressWarnings("unchecked") public synchronized Map removeComposited(final Map map) { - final int size = this.composite.length; + final int size = composite.length; for (int i = 0; i < size; ++i) { - if (this.composite[i].equals(map)) { + if (composite[i].equals(map)) { final Map[] temp = new Map[size - 1]; - System.arraycopy(this.composite, 0, temp, 0, i); - System.arraycopy(this.composite, i + 1, temp, i, size - i - 1); - this.composite = temp; + System.arraycopy(composite, 0, temp, 0, i); + System.arraycopy(composite, i + 1, temp, i, size - i - 1); + composite = temp; return map; } } @@ -536,8 +536,8 @@ public class CompositeMap extends AbstractIterableMap implements Ser @Override public int size() { int size = 0; - for (int i = this.composite.length - 1; i >= 0; --i) { - size += this.composite[i].size(); + for (int i = composite.length - 1; i >= 0; --i) { + size += composite[i].size(); } return size; } diff --git a/src/main/java/org/apache/commons/collections4/map/ListOrderedMap.java b/src/main/java/org/apache/commons/collections4/map/ListOrderedMap.java index 21937e836..f08dcb1af 100644 --- a/src/main/java/org/apache/commons/collections4/map/ListOrderedMap.java +++ b/src/main/java/org/apache/commons/collections4/map/ListOrderedMap.java @@ -97,7 +97,7 @@ public class ListOrderedMap @Override public void clear() { - this.parent.clear(); + parent.clear(); } @Override @@ -131,7 +131,7 @@ public class ListOrderedMap @Override public boolean isEmpty() { - return this.parent.isEmpty(); + return parent.isEmpty(); } @Override @@ -155,7 +155,7 @@ public class ListOrderedMap @Override public int size() { - return this.parent.size(); + return parent.size(); } @Override @@ -174,12 +174,12 @@ public class ListOrderedMap @Override public void clear() { - this.parent.clear(); + parent.clear(); } @Override public boolean contains(final Object value) { - return this.parent.containsKey(value); + return parent.containsKey(value); } @Override @@ -194,7 +194,7 @@ public class ListOrderedMap @Override public int size() { - return this.parent.size(); + return parent.size(); } } @@ -334,17 +334,17 @@ public class ListOrderedMap @Override public void clear() { - this.parent.clear(); + parent.clear(); } @Override public boolean contains(final Object value) { - return this.parent.containsValue(value); + return parent.containsValue(value); } @Override public V get(final int index) { - return this.parent.getValue(index); + return parent.getValue(index); } @Override @@ -359,17 +359,17 @@ public class ListOrderedMap @Override public V remove(final int index) { - return this.parent.remove(index); + return parent.remove(index); } @Override public V set(final int index, final V value) { - return this.parent.setValue(index, value); + return parent.setValue(index, value); } @Override public int size() { - return this.parent.size(); + return parent.size(); } } @@ -452,7 +452,7 @@ public class ListOrderedMap */ @Override public Set> entrySet() { - return new EntrySetView<>(this, this.insertOrder); + return new EntrySetView<>(this, insertOrder); } /** 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 95f05ec79..bae286526 100644 --- a/src/main/java/org/apache/commons/collections4/multimap/AbstractListValuedMap.java +++ b/src/main/java/org/apache/commons/collections4/multimap/AbstractListValuedMap.java @@ -64,10 +64,10 @@ public abstract class AbstractListValuedMap extends AbstractMultiValuedMap if (getMap().get(key) == null) { final List list = createCollection(); getMap().put(key, list); - this.values = list; - this.iterator = list.listIterator(); + values = list; + iterator = list.listIterator(); } - this.iterator.add(value); + iterator.add(value); } @Override diff --git a/src/main/java/org/apache/commons/collections4/set/CompositeSet.java b/src/main/java/org/apache/commons/collections4/set/CompositeSet.java index 3d52484f6..05f6596f6 100644 --- a/src/main/java/org/apache/commons/collections4/set/CompositeSet.java +++ b/src/main/java/org/apache/commons/collections4/set/CompositeSet.java @@ -194,7 +194,7 @@ public class CompositeSet implements Set, Serializable { for (final Set existingSet : getSets()) { final Collection intersects = CollectionUtils.intersection(existingSet, set); if (!intersects.isEmpty()) { - if (this.mutator == null) { + if (mutator == null) { throw new UnsupportedOperationException( "Collision adding composited set with no SetMutator set"); } diff --git a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java index 717d599da..7b7fa7503 100644 --- a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java @@ -843,18 +843,18 @@ public abstract class AbstractMapTest extends AbstractObjectTest { * Resets the {@link #map}, {@link #entrySet}, {@link #keySet}, {@link #values} and {@link #confirmed} fields to empty. */ public void resetEmpty() { - this.map = makeObject(); + map = makeObject(); views(); - this.confirmed = makeConfirmedMap(); + confirmed = makeConfirmedMap(); } /** * Resets the {@link #map}, {@link #entrySet}, {@link #keySet}, {@link #values} and {@link #confirmed} fields to full. */ public void resetFull() { - this.map = makeFullMap(); + map = makeFullMap(); views(); - this.confirmed = makeConfirmedMap(); + confirmed = makeConfirmedMap(); final K[] k = getSampleKeys(); final V[] v = getSampleValues(); for (int i = 0; i < k.length; i++) { @@ -1920,10 +1920,10 @@ public abstract class AbstractMapTest extends AbstractObjectTest { * Resets the collection view fields. */ private void views() { - this.keySet = getMap().keySet(); + keySet = getMap().keySet(); // see verifyValues: retrieve the values collection only when verifying them // this.values = getMap().values(); - this.entrySet = getMap().entrySet(); + entrySet = getMap().entrySet(); } } diff --git a/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java b/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java index 092525215..2ea551129 100644 --- a/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java @@ -72,7 +72,7 @@ public class CompositeMapTest extends AbstractIterableMapTest { @BeforeEach public void setUp() throws Exception { - this.pass = false; + pass = false; } @Test diff --git a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java index f4d368287..fd0e7b42d 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java @@ -669,16 +669,16 @@ public abstract class AbstractMultiValuedMapTest extends AbstractObjectTes * Resets the {@link #map} and {@link #confirmed} fields to empty. */ public void resetEmpty() { - this.map = makeObject(); - this.confirmed = makeConfirmedMap(); + map = makeObject(); + confirmed = makeConfirmedMap(); } /** * Resets the {@link #map} and {@link #confirmed} fields to full. */ public void resetFull() { - this.map = makeFullMap(); - this.confirmed = makeConfirmedMap(); + map = makeFullMap(); + confirmed = makeConfirmedMap(); final K[] k = getSampleKeys(); final V[] v = getSampleValues(); for (int i = 0; i < k.length; i++) {