private void readSortableTypes(SortableType[] sortableTypes, Dex buffer, IndexMap indexMap) {
    for (ClassDef classDef : buffer.classDefs()) {
      SortableType sortableType = indexMap.adjust(new SortableType(buffer, indexMap, classDef));
      int t = sortableType.getTypeIndex();
      if (sortableTypes[t] == null) {
        sortableTypes[t] = sortableType;
      } else if (collisionPolicy != CollisionPolicy.KEEP_FIRST) {
        throw new DexException(
            "Multiple dex files define " + buffer.typeNames().get(classDef.getTypeIndex()));
      }
    }
  }
Reads just enough data on each class so that we can sort it and then find it later.
android/android_framework/dex-maker/src/main/java/com/android/dx/merge/DexMerger.java