@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_entry_to_primitive__blank_first_cell__throws_exception__key_type_was_entry() {
        DataTable table = parse("",
            "| code |                                                   |",
            "| KMSY | Louis Armstrong New Orleans International Airport |",
            "| KSFO | San Francisco International Airport               |",
            "| KSEA | Seattle–Tacoma International Airport              |",
            "| KJFK | John F. Kennedy International Airport             |");

        registry.defineDataTableType(new DataTableType(AirPortCode.class, AIR_PORT_CODE_TABLE_ENTRY_TRANSFORMER));

        CucumberDataTableException exception = assertThrows(
            CucumberDataTableException.class,
            () -> converter.toMap(table, AirPortCode.class, String.class));
        assertThat(exception.getMessage(), is("" +
                "Can't convert DataTable to Map<io.cucumber.datatable.DataTableTypeRegistryTableConverterTest$AirPortCode, java.lang.String>.\n"
                +
                "The first cell was either blank or you have registered a TableEntryTransformer for the key type.\n" +
                "\n" +
                "This requires that there is a TableEntryTransformer for the value type but I couldn't find any.\n" +
                "\n" +
                "You can either:\n" +
                "\n" +
                "  1) Use a DataTableType that uses a TableEntryTransformer for class java.lang.String\n" +
                "\n" +
                "  2) Add a key to the first cell and use a DataTableType that uses a TableEntryTransformer for class io.cucumber.datatable.DataTableTypeRegistryTableConverterTest$AirPortCode"));
    }