|
18 | 18 |
|
19 | 19 | import com.couchbase.client.java.json.JsonObject;
|
20 | 20 |
|
21 |
| -import java.util.HashMap; |
| 21 | +import java.util.TreeMap; |
22 | 22 | import java.util.Map;
|
23 | 23 |
|
24 | 24 | /**
|
25 | 25 | * A {@link CouchbaseDocument} is an abstract representation of a document stored inside Couchbase Server.
|
26 | 26 | * <p/>
|
27 | 27 | * <p>
|
28 |
| - * It acts like a {@link HashMap}, but only allows those types to be written that are supported by the underlying |
| 28 | + * It acts like a {@link TreeMap}, but only allows those types to be written that are supported by the underlying |
29 | 29 | * storage format, which is currently JSON. Note that JSON conversion is not happening here, but performed at a
|
30 | 30 | * different stage based on the payload stored in the {@link CouchbaseDocument}.
|
31 | 31 | * </p>
|
@@ -85,7 +85,7 @@ public CouchbaseDocument(final String id) {
|
85 | 85 | public CouchbaseDocument(final String id, final int expiration) {
|
86 | 86 | this.id = id;
|
87 | 87 | this.expiration = expiration;
|
88 |
| - content = new HashMap<>(); |
| 88 | + content = new TreeMap<>(); |
89 | 89 | }
|
90 | 90 |
|
91 | 91 | /**
|
@@ -119,8 +119,8 @@ public final Object get(final String key) {
|
119 | 119 | *
|
120 | 120 | * @return
|
121 | 121 | */
|
122 |
| - public final HashMap<String, Object> export() { |
123 |
| - HashMap<String, Object> toExport = new HashMap<String, Object>(content); |
| 122 | + public final TreeMap<String, Object> export() { |
| 123 | + TreeMap<String, Object> toExport = new TreeMap<String, Object>(content); |
124 | 124 | for (Map.Entry<String, Object> entry : content.entrySet()) {
|
125 | 125 | if (entry.getValue() instanceof CouchbaseDocument) {
|
126 | 126 | toExport.put(entry.getKey(), ((CouchbaseDocument) entry.getValue()).export());
|
|
0 commit comments