Skip to content

Commit

Permalink
Add missing Javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jun 23, 2024
1 parent 5417dba commit 2b29deb
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,41 +35,79 @@ protected AbstractEmptyIterator() {

/**
* 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");
Expand All @@ -80,7 +118,13 @@ public void reset() {
// 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");
}

Expand Down

0 comments on commit 2b29deb

Please sign in to comment.