为什么 Vector 和 HashTable 被广泛认为应该被弃用?
另外,Sun/Oracle 对此有官方说法吗?
谢谢。
编辑: 我知道另一个话题,但它没有提到是否有官方说法,这就是为什么这个话题被称为“广泛相信”。另外,该主题仅涉及向量,而不涉及哈希表。
Possible Duplicate:
Why Java Vector class is considered obsolete or deprecated?
Also, is there an official word from Sun/Oracle on that?
Thanks.
EDIT:
I'm aware of the other topic, but it didn't mention whether there was an official word on this, which is why the topic is worded as "widely believed". Plus, that topic addresses only the Vector, not the Hashtable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Vector
已同步;通常你不需要这个,因为它会产生严重的开销。Hashtable
也是同步的,无法合理存储null
。人们使用各种列表和 HashMap 来代替。
Vector
is synchronized; usually you don't need this as it incurs serious overhead.Hashtable
is also synchronized and can't reasonably storenull
s.People use various Lists and
HashMap
instead.