ordered
ordered copied to clipboard
Associative methods don't work on transient ordered maps
trafficstars
OrderedMap doesn't implement ITransientAssociative2 (which the clojure.core transient maps do), so using contains? or find on a transient OrderedMap throws a contains? not supported on type: flatland.ordered.map.TransientOrderedMap error.
Looking at clojure.core, the simplest solution is to just implement ITransientAssociative2 directly, mirroring the existing Java implementation in ATransientMap:
clojure.lang.ITransientAssociative2
(containsKey [this k]
(not= (.valAt this k ::not-found) ::not-found))
(entryAt [this k]
(let [v (.valAt this k ::not-found)]
(when (not= v ::not-found)
(MapEntry. k v))))
If #68 is acceptable, ::not-found could be switched to not-found as well.