From 7b92e562abac1d96abf492a3e91918253d6db39e Mon Sep 17 00:00:00 2001 From: Tobi Date: Fri, 21 Aug 2020 16:40:39 +0200 Subject: [PATCH] [COLLECTIONS-765] Corrected javadoc and thrown exception type to match the functionallity --- .../collections4/iterators/ListIteratorWrapper.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/iterators/ListIteratorWrapper.java b/src/main/java/org/apache/commons/collections4/iterators/ListIteratorWrapper.java index 52a89d274..7784dfbfd 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ListIteratorWrapper.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ListIteratorWrapper.java @@ -203,12 +203,13 @@ public class ListIteratorWrapper implements ResettableListIterator { } /** - * Throws {@link UnsupportedOperationException} if {@link #previous()} has ever been called. + * Removes the last element that was returned by {@link #next()} or {@link #previous()} from the underlying collection. + * This call can only be made once per call to {@code next} or {@code previous} and only if {@link #add()} was not called in between. * - * @throws UnsupportedOperationException always + * @throws IllegalStateException if {@code next} or {@code previous} have not been called before, or if {@code remove} or {@code add} have been called after the last call to {@code next} or {@code previous} */ @Override - public void remove() throws UnsupportedOperationException { + public void remove() throws IllegalStateException { if (iterator instanceof ListIterator) { iterator.remove(); return;