Permalink
Browse files

Use OrderedMap for protobuf maps

  • Loading branch information...
1 parent d374651 commit ebb18b0624d27c14f3bc8c9255576bbfe73f2917 @amalloy amalloy committed Apr 23, 2012
Showing with 4 additions and 4 deletions.
  1. +1 −1 project.clj
  2. +3 −3 src/protobuf/core/PersistentProtocolBufferMap.java
View
2 project.clj
@@ -1,7 +1,7 @@
(defproject protobuf "0.6.0-beta14"
:description "Clojure-protobuf provides a clojure interface to Google's protocol buffers."
:dependencies [[clojure "1.2.0"]
- [ordered-set "0.2.3"]
+ [ordered-set "0.3.0"]
[useful "0.8.0-alpha1"]
[fs "1.0.0"]
[conch "0.2.0"]
View
6 src/protobuf/core/PersistentProtocolBufferMap.java
@@ -21,6 +21,7 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import ordered_map.core.OrderedMap;
import ordered_set.core.OrderedSet;
import clojure.lang.APersistentMap;
import clojure.lang.ASeq;
@@ -38,7 +39,6 @@
import clojure.lang.Numbers;
import clojure.lang.Obj;
import clojure.lang.PersistentArrayMap;
-import clojure.lang.PersistentHashMap;
import clojure.lang.PersistentVector;
import clojure.lang.RT;
import clojure.lang.SeqIterator;
@@ -364,7 +364,7 @@ protected Object fromProtoValue(Descriptors.FieldDescriptor field, Object value,
Object map_field_by = def.mapFieldBy(field);
DescriptorProtos.FieldOptions options = field.getOptions();
if (map_field_by != null) {
- ITransientMap map = PersistentHashMap.EMPTY.asTransient();
+ ITransientMap map = (ITransientMap)OrderedMap.EMPTY.asTransient();
while (iterator.hasNext()) {
PersistentProtocolBufferMap v = (PersistentProtocolBufferMap)fromProtoValue(field,
iterator.next());
@@ -390,7 +390,7 @@ protected Object fromProtoValue(Descriptors.FieldDescriptor field, Object value,
Descriptors.FieldDescriptor key_field = type.findFieldByName("key");
Descriptors.FieldDescriptor val_field = type.findFieldByName("val");
- ITransientMap map = PersistentHashMap.EMPTY.asTransient();
+ ITransientMap map = (ITransientMap)OrderedMap.EMPTY.asTransient();
while (iterator.hasNext()) {
DynamicMessage message = (DynamicMessage)iterator.next();
Object k = fromProtoValue(key_field, message.getField(key_field));

0 comments on commit ebb18b0

Please sign in to comment.