Remove redundant keywords

This commit is contained in:
Gary Gregory 2024-08-25 16:18:24 -04:00
parent 6ae173285b
commit c788e536a9
20 changed files with 119 additions and 119 deletions

View File

@ -131,7 +131,7 @@ public class FluentIterable<E> implements Iterable<E> {
* Don't allow instances.
*/
FluentIterable() {
this.iterable = this;
iterable = this;
}
/**

View File

@ -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

View File

@ -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

View File

@ -326,7 +326,7 @@ public class LayerManager<T extends BloomFilter> 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<T extends BloomFilter> implements BloomFilterExtractor
* @see LayerManager.Builder#setCleanup(Consumer)
*/
void next() {
this.filterCleanup.accept(filters);
filterCleanup.accept(filters);
addFilter();
}

View File

@ -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;

View File

@ -157,7 +157,7 @@ public final class BooleanComparator implements Comparator<Boolean>, Serializabl
public boolean equals(final Object object) {
return this == object ||
object instanceof BooleanComparator &&
this.trueFirst == ((BooleanComparator) object).trueFirst;
trueFirst == ((BooleanComparator) object).trueFirst;
}
/**

View File

@ -134,12 +134,12 @@ public class NullComparator<E> implements Comparator<E>, 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<E> implements Comparator<E>, Serializable {
final NullComparator<?> other = (NullComparator<?>) obj;
return this.nullsAreHigh == other.nullsAreHigh &&
this.nonNullComparator.equals(other.nonNullComparator);
return nullsAreHigh == other.nullsAreHigh &&
nonNullComparator.equals(other.nonNullComparator);
}
/**

View File

@ -81,9 +81,9 @@ public class TransformingComparator<I, O> implements Comparator<I>, 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);
}
/**

View File

@ -137,7 +137,7 @@ public class ArrayIterator<E> implements ResettableIterator<E> {
* @since 4.0
*/
public int getEndIndex() {
return this.endIndex;
return endIndex;
}
/**
@ -147,7 +147,7 @@ public class ArrayIterator<E> implements ResettableIterator<E> {
* @since 4.0
*/
public int getStartIndex() {
return this.startIndex;
return startIndex;
}
// Iterator interface
@ -192,7 +192,7 @@ public class ArrayIterator<E> implements ResettableIterator<E> {
*/
@Override
public void reset() {
this.index = this.startIndex;
index = startIndex;
}
}

View File

@ -113,7 +113,7 @@ public class ArrayListIterator<E> extends ArrayIterator<E>
*/
@Override
public boolean hasPrevious() {
return this.index > this.startIndex;
return index > startIndex;
}
/**
@ -128,8 +128,8 @@ public class ArrayListIterator<E> extends ArrayIterator<E>
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<E> extends ArrayIterator<E>
*/
@Override
public int nextIndex() {
return this.index - this.startIndex;
return index - startIndex;
}
/**
@ -154,8 +154,8 @@ public class ArrayListIterator<E> extends ArrayIterator<E>
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<E> extends ArrayIterator<E>
*/
@Override
public int previousIndex() {
return this.index - this.startIndex - 1;
return index - startIndex - 1;
}
/**
@ -174,7 +174,7 @@ public class ArrayListIterator<E> extends ArrayIterator<E>
@Override
public void reset() {
super.reset();
this.lastItemIndex = -1;
lastItemIndex = -1;
}
/**
@ -197,11 +197,11 @@ public class ArrayListIterator<E> extends ArrayIterator<E>
*/
@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);
}
}

View File

@ -92,9 +92,9 @@ public class ObjectArrayIterator<E> implements ResettableIterator<E> {
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<E> implements ResettableIterator<E> {
* @return the array this iterator iterates over
*/
public E[] getArray() {
return this.array;
return array;
}
/**
@ -112,7 +112,7 @@ public class ObjectArrayIterator<E> implements ResettableIterator<E> {
* @return the end index
*/
public int getEndIndex() {
return this.endIndex;
return endIndex;
}
/**
@ -121,7 +121,7 @@ public class ObjectArrayIterator<E> implements ResettableIterator<E> {
* @return the start index
*/
public int getStartIndex() {
return this.startIndex;
return startIndex;
}
/**
@ -131,7 +131,7 @@ public class ObjectArrayIterator<E> implements ResettableIterator<E> {
*/
@Override
public boolean hasNext() {
return this.index < this.endIndex;
return index < endIndex;
}
/**
@ -146,7 +146,7 @@ public class ObjectArrayIterator<E> implements ResettableIterator<E> {
if (!hasNext()) {
throw new NoSuchElementException();
}
return this.array[this.index++];
return array[index++];
}
/**
@ -164,7 +164,7 @@ public class ObjectArrayIterator<E> implements ResettableIterator<E> {
*/
@Override
public void reset() {
this.index = this.startIndex;
index = startIndex;
}
}

View File

@ -105,7 +105,7 @@ public class ObjectArrayListIterator<E> extends ObjectArrayIterator<E>
*/
@Override
public boolean hasPrevious() {
return this.index > getStartIndex();
return index > getStartIndex();
}
/**
@ -119,8 +119,8 @@ public class ObjectArrayListIterator<E> extends ObjectArrayIterator<E>
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<E> extends ObjectArrayIterator<E>
*/
@Override
public int nextIndex() {
return this.index - getStartIndex();
return index - getStartIndex();
}
/**
@ -144,8 +144,8 @@ public class ObjectArrayListIterator<E> extends ObjectArrayIterator<E>
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<E> extends ObjectArrayIterator<E>
*/
@Override
public int previousIndex() {
return this.index - getStartIndex() - 1;
return index - getStartIndex() - 1;
}
/**
@ -164,7 +164,7 @@ public class ObjectArrayListIterator<E> extends ObjectArrayIterator<E>
@Override
public void reset() {
super.reset();
this.lastItemIndex = -1;
lastItemIndex = -1;
}
/**
@ -186,11 +186,11 @@ public class ObjectArrayListIterator<E> extends ObjectArrayIterator<E>
*/
@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;
}
}

View File

@ -797,10 +797,10 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
@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<K, V> extends AbstractHashedMap<K, V>
* @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<K, V> extends AbstractHashedMap<K, V>
* @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<K, V> extends AbstractHashedMap<K, V>
} else {
previous.next = entry.next;
}
this.size--;
size--;
refEntry.onPurge();
return;
}

View File

@ -193,17 +193,17 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> implements Ser
public synchronized void addComposited(final Map<K, V> map) throws IllegalArgumentException {
if (map != null) {
for (int i = composite.length - 1; i >= 0; --i) {
final Collection<K> intersect = CollectionUtils.intersection(this.composite[i].keySet(), map.keySet());
final Collection<K> 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<K, V>[] temp = Arrays.copyOf(this.composite, this.composite.length + 1);
final Map<K, V>[] temp = Arrays.copyOf(composite, composite.length + 1);
temp[temp.length - 1] = map;
this.composite = temp;
composite = temp;
}
}
@ -214,8 +214,8 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> 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<K, V> extends AbstractIterableMap<K, V> 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<K, V> extends AbstractIterableMap<K, V> 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<K, V> extends AbstractIterableMap<K, V> 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<K, V> extends AbstractIterableMap<K, V> 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<K, V> extends AbstractIterableMap<K, V> implements Ser
@Override
public Set<K> keySet() {
final CompositeSet<K> 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<K, V> extends AbstractIterableMap<K, V> 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<K, V> extends AbstractIterableMap<K, V> implements Ser
*/
@Override
public void putAll(final Map<? extends K, ? extends V> 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<K, V> extends AbstractIterableMap<K, V> 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<K, V> extends AbstractIterableMap<K, V> implements Ser
*/
@SuppressWarnings("unchecked")
public synchronized Map<K, V> removeComposited(final Map<K, V> 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<K, V>[] 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<K, V> extends AbstractIterableMap<K, V> 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;
}

View File

@ -97,7 +97,7 @@ public class ListOrderedMap<K, V>
@Override
public void clear() {
this.parent.clear();
parent.clear();
}
@Override
@ -131,7 +131,7 @@ public class ListOrderedMap<K, V>
@Override
public boolean isEmpty() {
return this.parent.isEmpty();
return parent.isEmpty();
}
@Override
@ -155,7 +155,7 @@ public class ListOrderedMap<K, V>
@Override
public int size() {
return this.parent.size();
return parent.size();
}
@Override
@ -174,12 +174,12 @@ public class ListOrderedMap<K, V>
@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<K, V>
@Override
public int size() {
return this.parent.size();
return parent.size();
}
}
@ -334,17 +334,17 @@ public class ListOrderedMap<K, V>
@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<K, V>
@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<K, V>
*/
@Override
public Set<Map.Entry<K, V>> entrySet() {
return new EntrySetView<>(this, this.insertOrder);
return new EntrySetView<>(this, insertOrder);
}
/**

View File

@ -64,10 +64,10 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
if (getMap().get(key) == null) {
final List<V> 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

View File

@ -194,7 +194,7 @@ public class CompositeSet<E> implements Set<E>, Serializable {
for (final Set<E> existingSet : getSets()) {
final Collection<E> 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");
}

View File

@ -843,18 +843,18 @@ public abstract class AbstractMapTest<K, V> 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<K, V> 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();
}
}

View File

@ -72,7 +72,7 @@ public class CompositeMapTest<K, V> extends AbstractIterableMapTest<K, V> {
@BeforeEach
public void setUp() throws Exception {
this.pass = false;
pass = false;
}
@Test

View File

@ -669,16 +669,16 @@ public abstract class AbstractMultiValuedMapTest<K, V> 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++) {