groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwagenleit...@apache.org
Subject [2/3] groovy git commit: GROOVY-7960: throw NoSuchElementException instead of returning null (closes #412)
Date Fri, 07 Oct 2016 04:01:54 GMT
GROOVY-7960: throw NoSuchElementException instead of returning null (closes #412)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/2e2e4718
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/2e2e4718
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/2e2e4718

Branch: refs/heads/master
Commit: 2e2e4718653234e9b070bb96d115f1902faf745f
Parents: d325790
Author: John Tompkins <tompkins.jt@gmail.com>
Authored: Sun Sep 4 11:17:31 2016 -0400
Committer: John Wagenleitner <jwagenleitner@apache.org>
Committed: Thu Oct 6 20:44:28 2016 -0700

----------------------------------------------------------------------
 src/main/groovy/lang/IntRange.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/2e2e4718/src/main/groovy/lang/IntRange.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/IntRange.java b/src/main/groovy/lang/IntRange.java
index 46e9b4a..6a87658 100644
--- a/src/main/groovy/lang/IntRange.java
+++ b/src/main/groovy/lang/IntRange.java
@@ -26,6 +26,7 @@ import java.util.AbstractList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.NoSuchElementException;
 
 /**
  * Represents a list of Integer objects starting at a specified {@code from} value up (or
down)
@@ -78,8 +79,7 @@ public class IntRange extends AbstractList<Integer> implements Range<Integer>
{
         @Override
         public Integer next() {
             if (!hasNext()) {
-                // TODO instead of returning null, do this: throw new NoSuchElementException();
-                return null;
+                throw new NoSuchElementException();
             }
             if (index++ > 0) {
                 if (isReverse()) {


Mime
View raw message