As the title states: I'd like to find an answer to the question why java.util.Properties
extends Hashtable<Object, Object>
instead of Hashtable<String, String>
?
class Properties extends Hashtable<Object,Object> { ... }
I wonder because the method setProperty(String key, String value)
accepts only String values and the properties are based on the String key-value representation. The full method body is on the link above and here:
public synchronized Object setProperty(String key, String value) {
return put(key, value);
}
The same goes for the getProperty(String key)
method and the other ones.
Is there any specific reason extend Hashtable<Object, Object>
and use Strings? Is there any use-case I should be aware while using Hastable<Object, Object>
or HashMap<Object, Object>
like in this way?