Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

import com.couchbase.client.java.json.JsonObject;

import java.util.HashMap;
import java.util.TreeMap;
import java.util.Map;

/**
* A {@link CouchbaseDocument} is an abstract representation of a document stored inside Couchbase Server.
* <p/>
* <p>
* It acts like a {@link HashMap}, but only allows those types to be written that are supported by the underlying
* It acts like a {@link TreeMap}, but only allows those types to be written that are supported by the underlying
* storage format, which is currently JSON. Note that JSON conversion is not happening here, but performed at a
* different stage based on the payload stored in the {@link CouchbaseDocument}.
* </p>
Expand Down Expand Up @@ -85,7 +85,7 @@ public CouchbaseDocument(final String id) {
public CouchbaseDocument(final String id, final int expiration) {
this.id = id;
this.expiration = expiration;
content = new HashMap<>();
content = new TreeMap<>();
}

/**
Expand Down Expand Up @@ -119,8 +119,8 @@ public final Object get(final String key) {
*
* @return
*/
public final HashMap<String, Object> export() {
HashMap<String, Object> toExport = new HashMap<String, Object>(content);
public final TreeMap<String, Object> export() {
TreeMap<String, Object> toExport = new TreeMap<String, Object>(content);
for (Map.Entry<String, Object> entry : content.entrySet()) {
if (entry.getValue() instanceof CouchbaseDocument) {
toExport.put(entry.getKey(), ((CouchbaseDocument) entry.getValue()).export());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ void writesAndReadsCustomConvertedClass() {
List<BigDecimal> listOfValues = new ArrayList<>();
listOfValues.add(value);
listOfValues.add(value2);
Map<String, BigDecimal> mapOfValues = new HashMap<>();
Map<String, BigDecimal> mapOfValues = new TreeMap<>();
mapOfValues.put("val1", value);
mapOfValues.put("val2", value2);

Expand Down