public MetaData getMetaData(int index) {
    if (indexMap == null || indexMap.length < index + 1) {
      int startFrom = 0;
      int lastIndex = index;

      if (indexMap != null) {
        startFrom = indexMap.length;
        indexMap = Arrays.copyOf(indexMap, index + 1);
      } else {
        String[] headers = context.headers();
        if (headers != null && lastIndex < headers.length) {
          lastIndex = headers.length;
        }

        int[] indexes = context.extractedFieldIndexes();
        if (indexes != null) {
          for (int i = 0; i < indexes.length; i++) {
            if (lastIndex < indexes[i]) {
              lastIndex = indexes[i];
            }
          }
        }

        indexMap = new MetaData[lastIndex + 1];
      }

      for (int i = startFrom; i < lastIndex + 1; i++) {
        indexMap[i] = new MetaData(i);
      }
    }
    return indexMap[index];
  }
 private String[] getValidatedHeaders() {
   String[] headers = context.headers();
   if (headers == null || headers.length == 0) {
     throw new IllegalStateException(
         "No headers parsed from input nor provided in the user settings. Only index-based operations are available.");
   }
   return headers;
 }
 private MetaData getMetaData(Enum<?> column) {
   String[] headers = context.headers();
   if (headers == null || headers.length == 0) {
     throw new IllegalStateException(
         "No headers parsed from input nor provided in the user settings. Only index-based operations are available.");
   }
   return getMetaData(context.indexOf(column));
 }
 @Override
 public String[] headers() {
   return context.headers();
 }