只是想知道。java.util.Properties
Vs和有java.util.HashMap<String, String>
什么区别?哪个更好?
它们是相似的,但是从设计的角度来看,该Properties
班被认为是对Java的“失误”之一,因为它是一个Hashtable
(而不是使用一个Hashtable)。它应该是一个接口。
尽可能使用摘要,因此首选:
Map<String, String> stuff = new HashMap<String, String>();
Properties
除非必须,否则避免使用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句