static Map<Integer, Schema.Field> mapFieldPositions(CSVFormat format, Schema schema) {
    List<String> header = Arrays.asList(format.getHeader());
    Map<Integer, Schema.Field> indexToFieldMap = new HashMap<>();
    for (Schema.Field field : schema.getFields()) {
      int index = getIndex(header, field);
      if (index >= 0) {
        indexToFieldMap.put(index, field);
      }
    }
    return indexToFieldMap;
  }
@Test
  public void testHeaderWithComments() {
    String[] comments = {"first line", "second line", "third line"};
    Schema schema =
        Schema.builder().addStringField("a_string").addStringField("another_string").build();
    ImmutableMap<Integer, Schema.Field> want =
        ImmutableMap.of(0, schema.getField("a_string"), 1, schema.getField("another_string"));
    Map<Integer, Schema.Field> got =
        CsvIOParseHelpers.mapFieldPositions(
            csvFormat()
                .withHeader("a_string", "another_string")
                .withHeaderComments((Object) comments),
            schema);
    assertEquals(want, got);
  }