AFAIK no conversion may be necessary, since Clojure maps are Java
maps.
user> (instance? java.util.Map {:foo "foo" :bah 3})
true
The only exception would be if your method expects a mutable map. In
that case,
user> (HashMap. {:foo "foo" :bah 3})
#<HashMap {:foo=foo, :bah=3}>
-Jason
On Feb 6, 11:02 am, Peter Wolf <[email protected]> wrote:
> 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.
>
> Thanks
> Peter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---