Merge pull request #270 from pedro-w/csv-274-documentation

[CSV-274] Add comments to iterator() and stream()
This commit is contained in:
Gary Gregory 2022-10-07 10:49:28 -04:00 committed by GitHub
commit d46919da26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 2 deletions

View File

@ -734,9 +734,16 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
* {@link IllegalStateException}.
* </p>
* <p>
* 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}.
* </p>
* <p>
* 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.
* </p>
*/
@Override
public Iterator<CSVRecord> iterator() {
@ -799,7 +806,10 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
/**
* Returns a sequential {@code Stream} with this collection as its source.
*
* <p>
* If the parser is closed, the stream will not produce any more values.
* See the comments in {@link iterator()}.
* </p>
* @return a sequential {@code Stream} with this collection as its source.
* @since 1.9.0
*/