public static PLSurrogateCollection createModuleCollection(List modules) {
    { List surrogatechildren = List.newList();
      PLSurrogateCollection plsurrogatecollection = PLSurrogateCollection.new_PLSurrogateCollection();

      { Module module = null;
        Cons iter000 = modules.theConsList;
        Cons collect000 = null;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
          module = ((Module)(iter000.value));
          if (collect000 == null) {
            {
              collect000 = Cons.cons(GuiServer.makeModuleSurrogate(module), Stella.NIL);
              if (surrogatechildren.theConsList == Stella.NIL) {
                surrogatechildren.theConsList = collect000;
              }
              else {
                Cons.addConsToEndOfConsList(surrogatechildren.theConsList, collect000);
              }
            }
          }
          else {
            {
              collect000.rest = Cons.cons(GuiServer.makeModuleSurrogate(module), Stella.NIL);
              collect000 = collect000.rest;
            }
          }
        }
      }
      surrogatechildren = surrogatechildren.sort(Native.find_java_method("edu.isi.powerloom.server.gui.PLSurrogate", "PLSurrogateL", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLSurrogate"), Native.find_java_class("edu.isi.powerloom.server.gui.PLSurrogate")}));
      plsurrogatecollection.PLSurrogate = surrogatechildren;
      return (plsurrogatecollection);
    }
  }