groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwagenleitner <...@git.apache.org>
Subject [GitHub] groovy pull request #440: Groovy-7961 : NoSuchElementException
Date Fri, 07 Oct 2016 01:19:35 GMT
Github user jwagenleitner commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/440#discussion_r82316120
  
    --- Diff: src/main/groovy/lang/ObjectRange.java ---
    @@ -450,6 +451,9 @@ public Comparable next() {
                     value = peek();
                     nextFetched = true;
                 }
    +            if (value == null) {
    +                throw new NoSuchElementException();
    +            }
    --- End diff --
    
    I think these first 2 `if` statements could be replaced by the following and would make
it cleaner:
    ```
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message