jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1298014 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/json/fast/JsopArray.java
Date Wed, 07 Mar 2012 16:36:45 GMT
Author: thomasm
Date: Wed Mar  7 16:36:45 2012
New Revision: 1298014

URL: http://svn.apache.org/viewvc?rev=1298014&view=rev
Log:
Support JsopArray.iterator() (as per Dominiques request :-)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/json/fast/JsopArray.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/json/fast/JsopArray.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/json/fast/JsopArray.java?rev=1298014&r1=1298013&r2=1298014&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/json/fast/JsopArray.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/json/fast/JsopArray.java
Wed Mar  7 16:36:45 2012
@@ -155,7 +155,26 @@ public class JsopArray extends Jsop impl
     }
 
     public Iterator<Object> iterator() {
-        throw new UnsupportedOperationException();
+        return new Iterator<Object>() {
+
+            int index;
+
+            @Override
+            public boolean hasNext() {
+                return index < size();
+            }
+
+            @Override
+            public Object next() {
+                return get(index++);
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+
+        };
     }
 
     public int lastIndexOf(Object o) {



Mime
View raw message