code: private int getTemplateTypeIndex(TemplateType key) {
      int maxIndex = Math.min(templateKeys.size(), templateValues.size());
      for (int i = maxIndex - 1; i >= 0; i--) {
        if (isSameKey(templateKeys.get(i), key)) {
          return i;
        }
      }
      return -1;
    }
docs: Returns the index of the JSType value associated with the specified
  template key. If no JSType value is associated, returns -1.