开发者

Is there the generic properites

开发者 https://www.devze.com 2023-02-20 11:16 出处:网络
Is there a generic properties in Java? Properties taks generic Hashmap inside, but itself seems is nongenric, is there generic propert开发者_开发技巧ies? Not in the standard API. You would have to r

Is there a generic properties in Java?

Properties taks generic Hashmap inside, but itself seems is nongenric, is there generic propert开发者_开发技巧ies?


Not in the standard API. You would have to roll your own (which by the way is quite easy).

Still though, I'm not sure I see any use of it. If the class itself should be non-generic, i.e. have a non-generic interface, what does it matter if it's internal structure is generic or not?


its EntrySet method is coming from HashMap which returns Map, I want something returned to be Map

Yes, that is unwieldy. Since JDK1.6 there is at least a getStringPropertyNames, which returns a Set<String> (as opposed to the old Enumeration<?>).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号