mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Allow json objects to retain order of loaded objects
This commit is contained in:
parent
d2015845e8
commit
a234823d0a
@ -1,6 +1,5 @@
|
|||||||
package com.volmit.iris.util;
|
package com.volmit.iris.util;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2002 JSON.org
|
Copyright (c) 2002 JSON.org
|
||||||
|
|
||||||
@ -33,15 +32,8 @@ import java.lang.reflect.Method;
|
|||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.ResourceBundle;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A JSONObject is an unordered collection of name/value pairs. Its external
|
* A JSONObject is an unordered collection of name/value pairs. Its external
|
||||||
@ -143,7 +135,7 @@ public class JSONObject
|
|||||||
/**
|
/**
|
||||||
* The map where the JSONObject's properties are kept.
|
* The map where the JSONObject's properties are kept.
|
||||||
*/
|
*/
|
||||||
private final Map<String, Object> map;
|
private final LinkedHashMap<String, Object> map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It is sometimes more convenient and less ambiguous to have a
|
* It is sometimes more convenient and less ambiguous to have a
|
||||||
@ -158,7 +150,7 @@ public class JSONObject
|
|||||||
*/
|
*/
|
||||||
public JSONObject()
|
public JSONObject()
|
||||||
{
|
{
|
||||||
this.map = new HashMap<String, Object>();
|
this.map = new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -261,7 +253,7 @@ public class JSONObject
|
|||||||
*/
|
*/
|
||||||
public JSONObject(Map<String, Object> map)
|
public JSONObject(Map<String, Object> map)
|
||||||
{
|
{
|
||||||
this.map = new HashMap<String, Object>();
|
this.map = new LinkedHashMap<>();
|
||||||
if(map != null)
|
if(map != null)
|
||||||
{
|
{
|
||||||
Iterator<Entry<String, Object>> i = map.entrySet().iterator();
|
Iterator<Entry<String, Object>> i = map.entrySet().iterator();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user