private List<UnsortedValue> readUnsortedValues(Dex source, IndexMap indexMap) {
      TableOfContents.Section section = getSection(source.getTableOfContents());
      if (!section.exists()) {
        return Collections.emptyList();
      }

      List<UnsortedValue> result = new ArrayList<UnsortedValue>();
      Dex.Section in = source.open(section.off);
      for (int i = 0; i < section.size; i++) {
        int offset = in.getPosition();
        T value = read(in, indexMap, 0);
        result.add(new UnsortedValue(source, indexMap, value, i, offset));
      }
      return result;
    }
Merges unsorted sections by reading them completely into memory and sorting in memory.
android/android_framework/dex-maker/src/main/java/com/android/dx/merge/DexMerger.java