code: private Map<String, ClassRef> getReferenceMap() {
          Map<String, ClassRef> mapping = new HashMap<String, ClassRef>();
          List<ClassRef> refs = getReferences();
  
          //It's best to have predictable order, so that we can generate uniform code.
          Collections.sort(refs, new Comparator<ClassRef>() {
              @Override
              public int compare(ClassRef o1, ClassRef o2) {
                  return o1.getFullyQualifiedName().compareTo(o2.getFullyQualifiedName());
              }
          });
  
          for (ClassRef ref : refs) {
              String key = ref.getDefinition().getName();
              if (!mapping.containsKey(key)) {
                  mapping.put(key, ref);
              }
          }
          return mapping;
      }
docs: Create a mapping from class name to {@link ClassRef}.