diff --git a/JSONArray.java b/JSONArray.java index 0853d00..531b89d 100644 --- a/JSONArray.java +++ b/JSONArray.java @@ -154,8 +154,10 @@ public class JSONArray implements Iterable { * A Collection. */ public JSONArray(Collection collection) { - this.myArrayList = new ArrayList(collection == null ? 0 : collection.size()); - if (collection != null) { + if (collection == null) { + this.myArrayList = new ArrayList(); + } else { + this.myArrayList = new ArrayList(collection.size()); for (Object o: collection){ this.myArrayList.add(JSONObject.wrap(o)); }