# mapEntryKeys<K, V> static method

ConvertingComparator<MapEntry<K, V>, K> mapEntryKeys<K, V>(

1. Comparator<K> comparator

)

Creates a comparator that compares MapEntry objects by their keys.

### 🔧 Example:

    final entries = [
      MapEntry('c', 1),
      MapEntry('a', 3),
      MapEntry('b', 2),
    ];
    entries.sort(ConvertingComparator.mapEntryKeys((a, b) => a.compareTo(b)));
    // Sorted by key: a, b, c

## Implementation

    static ConvertingComparator<MapEntry<K, V>, K> mapEntryKeys<K, V>(Comparator<K> comparator) {
      return ConvertingComparator<MapEntry<K, V>, K>(comparator, _MapEntryKeyConverter<K, V>());
    }