resources/src/main/java/org/robolectric/res/android/DynamicRefTable.java
int addMappings(final DynamicRefTable other) {
    if (mAssignedPackageId != other.mAssignedPackageId) {
      return UNKNOWN_ERROR;
    }

//    final int entryCount = other.mEntries.size();
//    for (size_t i = 0; i < entryCount; i++) {
//      ssize_t index = mEntries.indexOfKey(other.mEntries.keyAt(i));
//      if (index < 0) {
//        mEntries.add(other.mEntries.keyAt(i), other.mEntries[i]);
//      } else {
//        if (other.mEntries[i] != mEntries[index]) {
//          return UNKNOWN_ERROR;
//        }
//      }
//    }
    for (Entry<String, Byte> otherEntry : other.mEntries.entrySet()) {
      String key = otherEntry.getKey();
      Byte curValue = mEntries.get(key);
      if (curValue == null) {
        mEntries.put(key, otherEntry.getValue());
      } else {
        if (!Objects.equals(otherEntry.getValue(), curValue)) {
          return UNKNOWN_ERROR;
        }
      }
    }

    // Merge the lookup table. No entry can conflict
    // (value of 0 means not set).
    for (int i = 0; i < 256; i++) {
      if (mLookupTable[i] != other.mLookupTable[i]) {
        if (mLookupTable[i] == 0) {
          mLookupTable[i] = other.mLookupTable[i];
        } else if (other.mLookupTable[i] != 0) {
          return UNKNOWN_ERROR;
        }
      }
    }
    return NO_ERROR;
  }
int addMappings(final DynamicRefTable other) {
    if (mAssignedPackageId != other.mAssignedPackageId) {
      return UNKNOWN_ERROR;
    }

//    final int entryCount = other.mEntries.size();
//    for (size_t i = 0; i < entryCount; i++) {
//      ssize_t index = mEntries.indexOfKey(other.mEntries.keyAt(i));
//      if (index < 0) {
//        mEntries.add(other.mEntries.keyAt(i), other.mEntries[i]);
//      } else {
//        if (other.mEntries[i] != mEntries[index]) {
//          return UNKNOWN_ERROR;
//        }
//      }
//    }
    for (Entry<String, Byte> otherEntry : other.mEntries.entrySet()) {
      String key = otherEntry.getKey();
      Byte curValue = mEntries.get(key);
      if (curValue == null) {
        mEntries.put(key, otherEntry.getValue());
      } else {
        if (!Objects.equals(otherEntry.getValue(), curValue)) {
          return UNKNOWN_ERROR;
        }
      }
    }

    // Merge the lookup table. No entry can conflict
    // (value of 0 means not set).
    for (int i = 0; i < 256; i++) {
      if (mLookupTable[i] != other.mLookupTable[i]) {
        if (mLookupTable[i] == 0) {
          mLookupTable[i] = other.mLookupTable[i];
        } else if (other.mLookupTable[i] != 0) {
          return UNKNOWN_ERROR;
        }
      }
    }
    return NO_ERROR;
  }
Adds mappings from the other DynamicRefTable