From 700f7675809a07a3cfec2f93d422c6b2d7fd86e7 Mon Sep 17 00:00:00 2001 From: jmccullough Date: Mon, 8 Sep 2014 15:55:36 -0400 Subject: [PATCH] Using LinkedHashMap to preserve property order. --- JSONObject.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/JSONObject.java b/JSONObject.java index d66623110..d11aab06e 100755 --- a/JSONObject.java +++ b/JSONObject.java @@ -32,7 +32,7 @@ of this software and associated documentation files (the "Software"), to deal import java.lang.reflect.Modifier; import java.util.Collection; import java.util.Enumeration; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Iterator; import java.util.Locale; import java.util.Map; @@ -152,7 +152,7 @@ public String toString() { * Construct an empty JSONObject. */ public JSONObject() { - this.map = new HashMap(); + this.map = new LinkedHashMap(); } /** @@ -243,7 +243,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()) {