2009/9/11 carey <carey.pridg...@gmail.com>:
> (. dataLoader  getEnvironmentParticleSet)
>
> But what I want is to go through the list that this method returns and
> get the name of each particle in the list.
>
> I now that in Java this would be (inside some form of loop)
>
> dataLoader.getEnvironmentParticleSet().get(i).getName();
>
> but I can't seem to find how to translate this into clojure. I don't
> need to know how to do the loop, that I can work out. Where I'm stuck
> is how to get access to the particle names, as I would in the above
> line of Java code.

I'm not that experienced in this type of java interop, but it seems to
me that (iterator-seq) would help you. That is, you should be able to
do something like this:

(map <f> (-> dataLoader .getEnvironmentParticleSet .iterator iterator-seq))

More generically, you can produce a seq from a java.util.Iterator:

(iterator-seq (.iterator [1 2 3]))

-- 
  ! Lauri

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to