mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
comment added to explain the reason that JSON object is unordered
to avoid implementators' misconceptions and tries to reimplement the JSON object to keep the elements order
This commit is contained in:
parent
d0f5607998
commit
246350bbcd
1 changed files with 6 additions and 1 deletions
|
@ -164,7 +164,12 @@ public class JSONObject {
|
|||
* Construct an empty JSONObject.
|
||||
*/
|
||||
public JSONObject() {
|
||||
// HashMap is used on purpose to ensure that elements are unordered
|
||||
// HashMap is used on purpose to ensure that elements are unordered by
|
||||
// the specification.
|
||||
// JSON tends to be a portable transfer format to allows the container
|
||||
// implementations to rearrange their items for a faster element
|
||||
// retrieval based on associative access.
|
||||
// Therefore, an implementation mustn't rely on the order of the item.
|
||||
this.map = new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue