My co-worker wrote an app in Java, which I call as a library within my own 
app. His code is expecting an ArrayList, and up until now I've been handing 
in an empty one like this: 

        accounts (java.util.ArrayList. 1000)
        sentence-parse-response-map (.init instance-of-sentence-parser 
incoming-message accounts contacts required-fields)

In my own code, I fetch the accounts and store it in a Clojure vector. 
Imagine something like: 

["Lisa Hare" "Morgan Aung" "Ki Xi"]

If I do this: 

(ancestors (type accounts))

I see this:

#{clojure.lang.IPersistentStack java.lang.Comparable java.lang.Iterable 
clojure.lang.IMeta clojure.lang.IReduceInit clojure.lang.AFn 
clojure.lang.Associative clojure.lang.IReduce clojure.lang.ILookup 
clojure.lang.IHashEq clojure.lang.Counted java.util.Collection 
clojure.lang.Reversible clojure.lang.IEditableCollection 
clojure.lang.Seqable java.io.Serializable java.lang.Runnable 
clojure.lang.IPersistentVector java.util.concurrent.Callable 
clojure.lang.IObj java.util.RandomAccess clojure.lang.Indexed 
clojure.lang.Sequential java.util.List java.lang.Object clojure.lang.IFn 
clojure.lang.IPersistentCollection clojure.lang.APersistentVector}

This: 

(ancestors java.util.ArrayList)

gives me: 

#{java.lang.Iterable java.util.AbstractList java.util.Collection 
java.util.AbstractCollection java.io.Serializable java.util.RandomAccess 
java.util.List java.lang.Object java.lang.Cloneable}

So what is the shortest path (of casts) to go from what I have to what he 
expects? Should I cast to  java.util.List and then call .toArray()? 




-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to