@Override
    public <K, V> Map<K, V> toMap(DataTable dataTable, Type keyType, Type valueType) {
        requireNonNull(dataTable, "dataTable may not be null");
        requireNonNull(keyType, "keyType may not be null");
        requireNonNull(valueType, "valueType may not be null");

        if (dataTable.isEmpty()) {
            return emptyMap();
        }
        DataTable keyColumn = dataTable.columns(0, 1);
        DataTable valueColumns = dataTable.columns(1);

        String firstHeaderCell = keyColumn.cell(0, 0);
        boolean firstHeaderCellIsBlank = firstHeaderCell == null || firstHeaderCell.isEmpty();
        List<K> keys = convertEntryKeys(keyType, keyColumn, valueType, firstHeaderCellIsBlank);

        if (valueColumns.isEmpty()) {
            return createMap(keyType, keys, valueType, nCopies(keys.size(), null));
        }

        boolean keysImplyTableRowTransformer = keys.size() == dataTable.height() - 1;
        List<V> values = convertEntryValues(valueColumns, keyType, valueType, keysImplyTableRowTransformer);

        if (keys.size() != values.size()) {
            throw keyValueMismatchException(firstHeaderCellIsBlank, keys.size(), keyType, values.size(), valueType);
        }

        return createMap(keyType, keys, valueType, values);
    }
@Test
    void to_map_of_primitive_to_primitive__blank_first_cell__throws_exception__first_cell_was_blank() {
        DataTable table = parse("",
            " |                     | birthDate  |",
            " | Annie M. G. Schmidt | 1911-03-20 |",
            " | Roald Dahl          | 1916-09-13 |",
            " | Astrid Lindgren     | 1907-11-14 |");

        CucumberDataTableException exception = assertThrows(
            CucumberDataTableException.class,
            () -> converter.toMap(table, String.class, String.class));
        assertThat(exception.getMessage(), startsWith(format("" +
                "Can't convert DataTable to Map<%s, %s>.\n" +
                "The first cell was either blank or you have registered a TableEntryTransformer for the key type.",
            typeName(String.class), typeName(String.class))));
    }