Clojure: working with a java.util.HashMap in an idiomatic Clojure fashion
问题 I have a java.util.HashMap object m (a return value from a call to Java code) and I'd like to get a new map with an additional key-value pair. If m were a Clojure map, I could use: (assoc m "key" "value") But trying that on a HashMap gives: java.lang.ClassCastException: java.util.HashMap cannot be cast to clojure.lang.Associative No luck with seq either: (assoc (seq m) "key" "value") java.lang.ClassCastException: clojure.lang.IteratorSeq cannot be cast to clojure.lang.Associative The only way