@@ -76,7 +76,7 @@ of this software and associated documentation files (the "Software"), to deal
7676 * </ul>
7777
7878 * @author JSON.org
79- * @version 2011-11-24
79+ * @version 2011-12-19
8080 */
8181public class JSONArray {
8282
@@ -105,29 +105,29 @@ public JSONArray(JSONTokener x) throws JSONException {
105105 throw x .syntaxError ("A JSONArray text must start with '['" );
106106 }
107107 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+ }
131131 }
132132 }
133133
@@ -149,13 +149,13 @@ public JSONArray(String source) throws JSONException {
149149 * @param collection A Collection.
150150 */
151151 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 ()) {
156156 this .myArrayList .add (JSONObject .wrap (iter .next ()));
157- }
158- }
157+ }
158+ }
159159 }
160160
161161
@@ -555,8 +555,8 @@ public String optString(int index) {
555555 public String optString (int index , String defaultValue ) {
556556 Object object = this .opt (index );
557557 return JSONObject .NULL .equals (object )
558- ? object . toString ()
559- : defaultValue ;
558+ ? defaultValue
559+ : object . toString () ;
560560 }
561561
562562
@@ -775,7 +775,7 @@ public JSONArray put(int index, Object value) throws JSONException {
775775 * or null if there was no value.
776776 */
777777 public Object remove (int index ) {
778- Object o = this .opt (index );
778+ Object o = this .opt (index );
779779 this .myArrayList .remove (index );
780780 return o ;
781781 }
0 commit comments