diff --git a/JSONObject.java b/JSONObject.java index f8ee3590e..3cc6dcba3 100755 --- a/JSONObject.java +++ b/JSONObject.java @@ -31,7 +31,7 @@ of this software and associated documentation files (the "Software"), to deal import java.lang.reflect.Method; import java.util.Collection; import java.util.Enumeration; -import java.util.HashMap; +import java.util.TreeMap; import java.util.Iterator; import java.util.Locale; import java.util.Map; @@ -144,7 +144,7 @@ public String toString() { * Construct an empty JSONObject. */ public JSONObject() { - this.map = new HashMap(); + this.map = new TreeMap(); } @@ -233,7 +233,7 @@ public JSONObject(JSONTokener x) throws JSONException { * @throws JSONException */ public JSONObject(Map map) { - this.map = new HashMap(); + this(); if (map != null) { Iterator i = map.entrySet().iterator(); while (i.hasNext()) {