Deprecate AbstractEmptyIterator.add(E) without replacement

This commit is contained in:
Gary Gregory 2024-06-23 08:11:17 -04:00
parent d9d6f2098a
commit 969bfd2fe7
2 changed files with 9 additions and 1 deletions

View File

@ -26,6 +26,7 @@
<!-- FIX -->
<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>
<!-- ADD -->
<!-- UPDATE -->
</release>

View File

@ -33,7 +33,14 @@ abstract class AbstractEmptyIterator<E> implements ResettableIterator<E> {
protected AbstractEmptyIterator() {
}
public void add(final E obj) {
/**
* Always throws UnsupportedOperationException.
* @param ignore ignore.
* @throws UnsupportedOperationException
* @deprecated Will be removed in 5.0 without replacement.
*/
@Deprecated
public void add(final E ignore) {
throw new UnsupportedOperationException("add() not supported for empty Iterator");
}