This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

LList makeList


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]