summaryrefslogtreecommitdiffstats
path: root/json/src/main/java
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-01-10 11:17:43 +0000
committerNarayan Kamath <narayan@google.com>2014-01-13 10:37:56 +0000
commit319bef83054979209a01b484af34ce1087d28559 (patch)
tree9e0fdecdd8a5778e5f408df97c0268416539a29c /json/src/main/java
parentd1e95700f052dc5197ce807447d1f2bd8ac11aa7 (diff)
downloadlibcore-319bef83054979209a01b484af34ce1087d28559.zip
libcore-319bef83054979209a01b484af34ce1087d28559.tar.gz
libcore-319bef83054979209a01b484af34ce1087d28559.tar.bz2
Fix JSONObject#test_toString_listAsMapValues
Changed the map type in JSONObject to a LinkedHashMap so that its iteration order is well defined. bug: 12476022 Change-Id: I8f2e40fd6bca5f776396aba4c9fde6e9d58f662e
Diffstat (limited to 'json/src/main/java')
-rw-r--r--json/src/main/java/org/json/JSONObject.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/json/src/main/java/org/json/JSONObject.java b/json/src/main/java/org/json/JSONObject.java
index 5e73327..1f474b8 100644
--- a/json/src/main/java/org/json/JSONObject.java
+++ b/json/src/main/java/org/json/JSONObject.java
@@ -18,8 +18,8 @@ package org.json;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.Map;
// Note: this class was written without inspecting the non-free org.json sourcecode.
@@ -104,13 +104,13 @@ public class JSONObject {
}
};
- private final Map<String, Object> nameValuePairs;
+ private final LinkedHashMap<String, Object> nameValuePairs;
/**
* Creates a {@code JSONObject} with no name/value mappings.
*/
public JSONObject() {
- nameValuePairs = new HashMap<String, Object>();
+ nameValuePairs = new LinkedHashMap<String, Object>();
}
/**