You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/10/06 11:51:20 UTC

[GitHub] [commons-csv] garydgregory commented on a diff in pull request #270: [CSV-274] Add comments to iterator() and stream()

garydgregory commented on code in PR #270:
URL: https://github.com/apache/commons-csv/pull/270#discussion_r988928581


##########
src/main/java/org/apache/commons/csv/CSVParser.java:
##########
@@ -734,9 +734,24 @@ private boolean isStrictQuoteMode() {
      * {@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>

Review Comment:
   Let's not add an anti-pattern as a _code_ example here, please. IOW: Document what to do _correctly_, especially in code, not what to do _wrong_. There is always some way to shoot yourself in the foot. Describing the behavior as you do above is enough IMO.



##########
src/main/java/org/apache/commons/csv/CSVParser.java:
##########
@@ -799,7 +814,9 @@ CSVRecord nextRecord() throws IOException {
 
     /**
      * 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()}.

Review Comment:
   Close HTML tags.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org