This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
LList makeList
- From: Mark Wutka <mark at wutka dot com>
- To: kawa at sources dot redhat dot com
- Date: Tue, 8 Mar 2005 17:31:19 -0500
- Subject: LList makeList
- Organization: Wutka Consulting
I was wondering what kind of support Kawa had for Java collections and
saw the messages about using gnu.lists.LList:makeList to convert a Java
list into a Scheme list. I noticed in the source, it only accepts
java.util.List, but then it immediately retrieves the iterator and works
with that. It might be nice if it could take any collection, and also
any iterator. I tried this and it seemed to work fine:
public static LList makeList (java.util.Collection vals)
{
return makeList(vals.iterator());
}
public static LList makeList (java.util.Iterator e)
{
LList result = LList.Empty;
<rest of original makeList java.util.List here>
This way, I can iterate on HashMap.values() or HashMap.keySet(). Or is
there a better way to do this?
Mark