public int indexOf(CstBaseMethodRef ref) {
    if (ref == null) {
      throw new NullPointerException("ref == null");
    }

    throwIfNotPrepared();

    MethodIdItem item = methodIds.get(ref);

    if (item == null) {
      throw new IllegalArgumentException("not found");
    }

    return item.getIndex();
  }
Gets the index of the given reference, which must have been added to this instance.

@param ref {@code non-null;} the reference to look up
@return {@code >= 0;} the reference's index
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/file/MethodIdsSection.java