|
6 | 6 | */ |
7 | 7 | package org.piwik.java.tracking; |
8 | 8 |
|
9 | | -import java.util.HashMap; |
| 9 | +import java.util.LinkedHashMap; |
10 | 10 | import java.util.Map; |
11 | 11 | import java.util.Map.Entry; |
12 | 12 | import javax.json.Json; |
|
22 | 22 | * @author brettcsorba |
23 | 23 | */ |
24 | 24 | public class PiwikJsonObject{ |
25 | | - Map<String, String> map = new HashMap<>(); |
| 25 | + Map<String, String> map = new LinkedHashMap<>(); |
26 | 26 |
|
27 | 27 | /** |
28 | 28 | * Gets the custom value stored at this custom key. |
@@ -77,11 +77,20 @@ public int size(){ |
77 | 77 | * <br> |
78 | 78 | * {@code {"1": ["key1", "value1"], "2": ["key2": "value2"]} }<br> |
79 | 79 | * <br> |
80 | | - * could be produced. Note that there is no guarantee about the ordering of |
81 | | - * the produced JSON based. The following JSON is also valid and could also |
82 | | - * be produced:<br> |
| 80 | + * would be produced. The produced JSON will be ordered according to the |
| 81 | + * order the values were put in. Removing an object will cause the values |
| 82 | + * to backfill accordingly.<br> |
| 83 | + * <br> |
| 84 | + * For example, if the following values were put into the object<br> |
| 85 | + * <br> |
| 86 | + * {@code ("key1", "value1")}, {@code ("key2", "value2")}, and {@code ("key3", "value3")}<br> |
| 87 | + * <br> |
| 88 | + * and {@code ("key2", "value2") } was then removed, then<br> |
| 89 | + * <br> |
| 90 | + * {@code {"1": ["key1", "value1"], "2": ["key3": "value3"]} }<br> |
| 91 | + * <br> |
| 92 | + * would be produced. |
83 | 93 | * <br> |
84 | | - * {@code {"1": ["key2", "value2"], "2": ["key1": "value1"]} }. |
85 | 94 | * @return the JSON string representation of this object |
86 | 95 | */ |
87 | 96 | @Override |
|
0 commit comments