code: Map<JCCompilationUnit, Queue<Env<AttrContext>>> groupByFile(Queue<Env<AttrContext>> envs) {
              // use a LinkedHashMap to preserve the order of the original list as much as possible
              Map<JCCompilationUnit, Queue<Env<AttrContext>>> map = new LinkedHashMap<JCCompilationUnit, Queue<Env<AttrContext>>>();
              for (Env<AttrContext> env: envs) {
                  Queue<Env<AttrContext>> sublist = map.get(env.toplevel);
                  if (sublist == null) {
                      sublist = new ListBuffer<Env<AttrContext>>();
                      map.put(env.toplevel, sublist);
                  }
                  sublist.add(env);
              }
              return map;
          }
docs: where