obsolete

Why isn't ArrayList marked [Obsolete]?

杀马特。学长 韩版系。学妹 提交于 2019-11-26 05:35:04
问题 After a deep thought and looking into the implementation of ArrayList, personally I really want to say It\'s obsolete, I have no reason to use this class after 2.0 . But since it\'s not marked as [Obsolete] , is there any usage that I didn\'t know, better than using a generic class? If yes, please give an example. Thanks. EDIT Let\'s take List<T> as an example, it provides all functions of ArrayList , and it\'s strongly-typed. So when do we need to use ArrayList ? Maybe sometimes it has a

Why is Java Vector (and Stack) class considered obsolete or deprecated?

↘锁芯ラ 提交于 2019-11-26 01:17:58
问题 Why is Java Vector considered a legacy class, obsolete or deprecated? Isn\'t its use valid when working with concurrency? And if I don\'t want to manually synchronize objects and just want to use a thread-safe collection without needing to make fresh copies of the underlying array (as CopyOnWriteArrayList does), then is it fine to use Vector ? What about Stack , which is a subclass of Vector , what should I use instead of it? 回答1: Vector synchronizes on each individual operation. That's