@@ -76,7 +76,7 @@ of this software and associated documentation files (the "Software"), to deal
76
76
* </ul>
77
77
78
78
* @author JSON.org
79
- * @version 2011-11-24
79
+ * @version 2011-12-19
80
80
*/
81
81
public class JSONArray {
82
82
@@ -105,29 +105,29 @@ public JSONArray(JSONTokener x) throws JSONException {
105
105
throw x .syntaxError ("A JSONArray text must start with '['" );
106
106
}
107
107
if (x .nextClean () != ']' ) {
108
- x .back ();
109
- for (;;) {
110
- if (x .nextClean () == ',' ) {
111
- x .back ();
112
- this .myArrayList .add (JSONObject .NULL );
113
- } else {
114
- x .back ();
115
- this .myArrayList .add (x .nextValue ());
116
- }
117
- switch (x .nextClean ()) {
118
- case ';' :
119
- case ',' :
120
- if (x .nextClean () == ']' ) {
121
- return ;
122
- }
123
- x .back ();
124
- break ;
125
- case ']' :
126
- return ;
127
- default :
128
- throw x .syntaxError ("Expected a ',' or ']'" );
129
- }
130
- }
108
+ x .back ();
109
+ for (;;) {
110
+ if (x .nextClean () == ',' ) {
111
+ x .back ();
112
+ this .myArrayList .add (JSONObject .NULL );
113
+ } else {
114
+ x .back ();
115
+ this .myArrayList .add (x .nextValue ());
116
+ }
117
+ switch (x .nextClean ()) {
118
+ case ';' :
119
+ case ',' :
120
+ if (x .nextClean () == ']' ) {
121
+ return ;
122
+ }
123
+ x .back ();
124
+ break ;
125
+ case ']' :
126
+ return ;
127
+ default :
128
+ throw x .syntaxError ("Expected a ',' or ']'" );
129
+ }
130
+ }
131
131
}
132
132
}
133
133
@@ -149,13 +149,13 @@ public JSONArray(String source) throws JSONException {
149
149
* @param collection A Collection.
150
150
*/
151
151
public JSONArray (Collection collection ) {
152
- this .myArrayList = new ArrayList ();
153
- if (collection != null ) {
154
- Iterator iter = collection .iterator ();
155
- while (iter .hasNext ()) {
152
+ this .myArrayList = new ArrayList ();
153
+ if (collection != null ) {
154
+ Iterator iter = collection .iterator ();
155
+ while (iter .hasNext ()) {
156
156
this .myArrayList .add (JSONObject .wrap (iter .next ()));
157
- }
158
- }
157
+ }
158
+ }
159
159
}
160
160
161
161
@@ -555,8 +555,8 @@ public String optString(int index) {
555
555
public String optString (int index , String defaultValue ) {
556
556
Object object = this .opt (index );
557
557
return JSONObject .NULL .equals (object )
558
- ? object . toString ()
559
- : defaultValue ;
558
+ ? defaultValue
559
+ : object . toString () ;
560
560
}
561
561
562
562
@@ -775,7 +775,7 @@ public JSONArray put(int index, Object value) throws JSONException {
775
775
* or null if there was no value.
776
776
*/
777
777
public Object remove (int index ) {
778
- Object o = this .opt (index );
778
+ Object o = this .opt (index );
779
779
this .myArrayList .remove (index );
780
780
return o ;
781
781
}
0 commit comments