This explanation
does not make a lot of sense here. I think it is clearer to say eitherMap has a method named keySet(), which returns Set<K>.
1:
Properties extends Hashtable<Object, Object> (note the concrete generic type of Object), so all references to K, V declared in Hashtable<K, V> become Object, Object. Just saying that Properties extends Hashtable is not enough; It should be Hashtable<Object, Object>.
2:
Properties overrides keySet() (and a bunch of other methods) to explicitly return Set<Object> in its source codeCode: Select all
@Override public Set<Object> keySet() { return Collections.synchronizedSet(map.keySet(), this); }