hello Peter Wolf a écrit : > Hello, how do I do this elegantly? > > I have a Clojure Map = {:foo "foo" :bah 3 ... } > > and I need to pass it to a Java method that is expecting a > Map<String,Object> = { "foo" --> "foo" , "bah" --> 3 ...} > > How does one convert a Clojure Map to the equivalent Java Map? I bet I > could do it in one line if I knew the magic. > (into {} (for [[k v] {:foo "foo" :bah 3}] [(name k) v])) returns {"bah" 3, "foo" "foo"}
and since Clojure maps implement, albeit read-only, java.util.Map you can directly pass them to a java method. Christophe -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.blogspot.com/ (en) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---