From 552c114d4b14225011df938051bb135e38dbd0d8 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 25 Aug 2024 16:31:55 -0400 Subject: [PATCH] Better parameter names --- .../collections4/iterators/CollatingIterator.java | 12 ++++++------ .../collections4/iterators/FilterListIterator.java | 4 ++-- .../iterators/ObjectArrayListIterator.java | 1 - .../iterators/SingletonListIterator.java | 6 +++--- .../iterators/UnmodifiableListIterator.java | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/iterators/CollatingIterator.java b/src/main/java/org/apache/commons/collections4/iterators/CollatingIterator.java index 2e1c12901..87f65e53d 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/CollatingIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/CollatingIterator.java @@ -327,15 +327,15 @@ public class CollatingIterator implements Iterator { * * @return {@code false} iff there was no value to set */ - private boolean set(final int i) { - final Iterator it = iterators.get(i); + private boolean set(final int index) { + final Iterator it = iterators.get(index); if (it.hasNext()) { - values.set(i, it.next()); - valueSet.set(i); + values.set(index, it.next()); + valueSet.set(index); return true; } - values.set(i, null); - valueSet.clear(i); + values.set(index, null); + valueSet.clear(index); return false; } diff --git a/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java index ab6616ae0..f79c46f73 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java @@ -193,11 +193,11 @@ public class FilterListIterator implements ListIterator { /** * Not supported. - * @param o the element with which to replace the last element returned by + * @param ignored the element with which to replace the last element returned by * {@code next} or {@code previous} */ @Override - public void set(final E o) { + public void set(final E ignored) { throw new UnsupportedOperationException("FilterListIterator.set(Object) is not supported."); } 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 faafa5703..0ce40da9b 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayListIterator.java @@ -189,7 +189,6 @@ public class ObjectArrayListIterator extends ObjectArrayIterator if (lastItemIndex == -1) { throw new IllegalStateException("must call next() or previous() before a call to set()"); } - array[lastItemIndex] = obj; } diff --git a/src/main/java/org/apache/commons/collections4/iterators/SingletonListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/SingletonListIterator.java index dc9a0e139..871010909 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/SingletonListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/SingletonListIterator.java @@ -166,16 +166,16 @@ public class SingletonListIterator implements ResettableListIterator { /** * Sets sets the value of the singleton. * - * @param obj the object to set + * @param object the object to set * @throws IllegalStateException if {@code next} has not been called * or the object has been removed */ @Override - public void set(final E obj) { + public void set(final E object) { if (!nextCalled || removed) { throw new IllegalStateException(); } - this.object = obj; + this.object = object; } } diff --git a/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableListIterator.java index cf80ad6b6..ee4689d9a 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableListIterator.java @@ -117,7 +117,7 @@ public final class UnmodifiableListIterator implements ListIterator, Unmod } @Override - public void set(final E obj) { + public void set(final E ignored) { throw new UnsupportedOperationException("set() is not supported"); }