Override `KeyVal` methods `getKey` and `getValue` to avoid explicit cast