code: static <K, V> Map<K, V> keyValuesToMap(Iterator<KeyValue<K, V>> keyValues) {
          Map<K, V> map = new HashMap<>();
          keyValues.forEachRemaining(pair -> map.put(pair.getKey(), pair.getValue()));
          return map;
      }
docs: Transforms an iterator of key-value pairs into a map
  
  @param keyValues an iterator of key-value pairs
  @param <K>       the type of the keys
  @param <V>       the type of the values
  @return the resulting map