Re: java.util.Properties extending from HashMap<Object, Object> instead of HashMap<String, String>



On Apr 4, 12:14 pm, Rakesh <rakesh.use...@xxxxxxxxx> wrote:
I was curious if there is a reason why java.util.Properties extends
from HashMap<Object, Object> instead of  HashMap<String, String>
(seems more intuitive to me).

A variation of that would be -
   how do we get about converting Properties to Map<String, String> .

Backwards compatability. In Java 1.4 and earlier,
Properties.get(Object) returned Object; changing that signature for
1.5 would break any code that used that method without an immediate
cast to String.

-o
.



Relevant Pages