Skip to content

Commit 04eab16

Browse files
committed
Merge pull request stleary#132 from douglascrockford/iterable-JSONArray
made JSONArray iterable.
2 parents 0cf7491 + d2cd1a8 commit 04eab16

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

JSONArray.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ of this software and associated documentation files (the "Software"), to deal
7575
* </ul>
7676
*
7777
* @author JSON.org
78-
* @version 2014-05-03
78+
* @version 2015-06-04
7979
*/
80-
public class JSONArray {
80+
public class JSONArray implements Iterable<Object> {
8181

8282
/**
8383
* The arrayList where the JSONArray's properties are kept.
@@ -179,6 +179,11 @@ public JSONArray(Object array) throws JSONException {
179179
}
180180
}
181181

182+
@Override
183+
public Iterator<Object> iterator() {
184+
return myArrayList.iterator();
185+
}
186+
182187
/**
183188
* Get the object value associated with an index.
184189
*

0 commit comments

Comments
 (0)