Add missing Javadocs

This commit is contained in:
Gary Gregory 2024-06-23 08:21:28 -04:00
parent 5417dba33c
commit 2b29deb2de
2 changed files with 49 additions and 4 deletions

View File

@ -27,6 +27,7 @@
<action issue="COLLECTIONS-857" type="fix" dev="ggregory" due-to="Claude Warren">Complete bloom filter documentation #507.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Package private AbstractEmptyIterator implements ResettableIterator so subclasses don't.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate AbstractEmptyIterator.add(E) without replacement.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Add missing Javadocs.</action>
<!-- ADD -->
<!-- UPDATE -->
</release>

View File

@ -35,41 +35,79 @@ abstract class AbstractEmptyIterator<E> implements ResettableIterator<E> {
/**
* Always throws UnsupportedOperationException.
* @param ignore ignore.
* @throws UnsupportedOperationException
*
* @param ignored ignore.
* @throws UnsupportedOperationException Always thrown.
* @deprecated Will be removed in 5.0 without replacement.
*/
@Deprecated
public void add(final E ignore) {
public void add(final E ignored) {
throw new UnsupportedOperationException("add() not supported for empty Iterator");
}
/**
* Always returns false, this iterator contains no elements.
*
* @return Always false.
*/
@Override
public boolean hasNext() {
return false;
}
/**
* Always returns false, this iterator contains no elements.
*
* @return Always false.
*/
public boolean hasPrevious() {
return false;
}
/**
* Always throws IllegalStateException, this iterator contains no elements.
*
* @return Always throws IllegalStateException.
* @throws IllegalStateException Always thrown.
*/
@Override
public E next() {
throw new NoSuchElementException("Iterator contains no elements");
}
/**
* Always returns 0, this iterator contains no elements.
*
* @return Always returns 0.
*/
public int nextIndex() {
return 0;
}
/**
* Always throws IllegalStateException, this iterator contains no elements.
*
* @return Always throws IllegalStateException.
* @throws IllegalStateException Always thrown.
*/
public E previous() {
throw new NoSuchElementException("Iterator contains no elements");
}
/**
* Always returns -1, this iterator contains no elements.
*
* @return Always returns -1.
*/
public int previousIndex() {
return -1;
}
/**
* Always throws IllegalStateException, this iterator contains no elements.
*
* @throws IllegalStateException Always thrown.
*/
@Override
public void remove() {
throw new IllegalStateException("Iterator contains no elements");
@ -80,7 +118,13 @@ abstract class AbstractEmptyIterator<E> implements ResettableIterator<E> {
// do nothing
}
public void set(final E obj) {
/**
* Always throws IllegalStateException, this iterator contains no elements.
*
* @param ignored ignored.
* @throws IllegalStateException Always thrown.
*/
public void set(final E ignored) {
throw new IllegalStateException("Iterator contains no elements");
}