Skip to content

Commit 700f767

Browse files
author
jmccullough
committed
Using LinkedHashMap to preserve property order.
1 parent 8114b97 commit 700f767

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

JSONObject.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ of this software and associated documentation files (the "Software"), to deal
3232
import java.lang.reflect.Modifier;
3333
import java.util.Collection;
3434
import java.util.Enumeration;
35-
import java.util.HashMap;
35+
import java.util.LinkedHashMap;
3636
import java.util.Iterator;
3737
import java.util.Locale;
3838
import java.util.Map;
@@ -152,7 +152,7 @@ public String toString() {
152152
* Construct an empty JSONObject.
153153
*/
154154
public JSONObject() {
155-
this.map = new HashMap<String, Object>();
155+
this.map = new LinkedHashMap<String, Object>();
156156
}
157157

158158
/**
@@ -243,7 +243,7 @@ public JSONObject(JSONTokener x) throws JSONException {
243243
* @throws JSONException
244244
*/
245245
public JSONObject(Map<String, Object> map) {
246-
this.map = new HashMap<String, Object>();
246+
this();
247247
if (map != null) {
248248
Iterator<Entry<String, Object>> i = map.entrySet().iterator();
249249
while (i.hasNext()) {

0 commit comments

Comments
 (0)