JSONArrayIterator.java
1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.sling.commons.json.JSONArray
* org.apache.sling.commons.json.JSONException
* org.apache.sling.commons.json.JSONObject
*/
package com.adobe.aemds.guide.utils;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.sling.commons.json.JSONArray;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public class JSONArrayIterator
implements Iterator<JSONObject> {
private final JSONArray arr;
private int current;
public JSONArrayIterator(JSONArray arr) {
this.arr = arr;
this.current = 0;
}
@Override
public boolean hasNext() {
return this.current < this.arr.length();
}
@Override
public JSONObject next() {
if (!this.hasNext()) {
throw new NoSuchElementException();
}
try {
return (JSONObject)this.arr.get(this.current++);
}
catch (JSONException e) {
throw new IllegalStateException(e.getMessage(), (Throwable)e);
}
}
@Override
public void remove() {
throw new UnsupportedOperationException("remove");
}
}