How can I create Java generic classes from Clojure?

112 views
Skip to first unread message

Bob Shock

unread,
Sep 28, 2009, 9:40:24 PM9/28/09
to Clojure
If I have a Java function that uses List<Integer> or
Map<String,Integer>, is there anyway to create these in Clojure the
same way I can create vectors or maps?

For example, if a function signature is:

void foobar(List x, Map y)

I can pass standard vectors and maps to it, but I can't figure out how
to do the same for this function:

void foobar(List<Int> x, Map<String,Integer> y)

Thanks.

Robert Fischer

unread,
Sep 29, 2009, 6:48:23 AM9/29/09
to clo...@googlegroups.com
Since generics are only at compile time, you should be able to pass them straight in via Clojure.
What is the specific code that's causing the problem?

~~ Robert Fischer, Smokejumper IT Consulting.
Enfranchised Mind Blog http://EnfranchisedMind.com/blog

Check out my book, "Grails Persistence with GORM and GSQL"!
http://www.smokejumperit.com/gormbook

Bob Shock

unread,
Sep 29, 2009, 11:50:50 PM9/29/09
to Clojure
Sorry, that was TOO easy. Too many years as a Java programmer have
rotted my brain!.

Reply all
Reply to author
Forward
0 new messages