diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java b/src/main/java/org/apache/commons/csv/CSVParser.java index bff55a00..fd4c3a90 100644 --- a/src/main/java/org/apache/commons/csv/CSVParser.java +++ b/src/main/java/org/apache/commons/csv/CSVParser.java @@ -734,9 +734,16 @@ public final class CSVParser implements Iterable, Closeable { * {@link IllegalStateException}. *

*

- * If the parser is closed a call to {@link Iterator#next()} will throw a + * If the parser is closed, the iterator will not yield any more records. + * A call to {@link Iterator#hasNext()} will return {@code false} and + * a call to {@link Iterator#next()} will throw a * {@link NoSuchElementException}. *

+ *

+ * If it is necessary to construct an iterator which is usable after the + * parser is closed, one option is to extract all records as a list with + * {@link getRecords()}, and return an iterator to that list. + *

*/ @Override public Iterator iterator() { @@ -799,7 +806,10 @@ public final class CSVParser implements Iterable, Closeable { /** * Returns a sequential {@code Stream} with this collection as its source. - * + *

+ * If the parser is closed, the stream will not produce any more values. + * See the comments in {@link iterator()}. + *

* @return a sequential {@code Stream} with this collection as its source. * @since 1.9.0 */