code: @SuppressWarnings("unchecked")
    public IType getMessageOrBuilder(int index) {
      if (this.builders == null) {
        // We don't have any builders -- return the current Message.
        // This is the case where no builder was created, so we MUST have a
        // Message.
        return (IType) messages.get(index);
      }
  
      SingleFieldBuilder<MType, BType, IType> builder = builders.get(index);
      if (builder == null) {
        // We don't have a builder -- return the current message.
        // This is the case where no builder was created for the entry at index,
        // so we MUST have a message.
        return (IType) messages.get(index);
  
      } else {
        return builder.getMessageOrBuilder();
      }
    }
docs: Gets the base class interface for the specified index. This may either be
  a builder or a message. It will return whatever is more efficient.
  
  @param index the index of the message to get
  @return the message or builder for the index as the base class interface