what are the legacy classes in Java? [closed]

若如初见. 提交于 2019-12-17 22:37:07

问题


I recently heard Vector is a Legacy class, then I read on a website that

Legacy classes are used to save Objects before Collections came.

So, why these are not called Deprecated classes, why Legacy?


回答1:


Legacy classes and interfaces are the classes and interfaces that formed the collections framework in the earlier versions of Java and how now been restructured or re-engineered. They are fully compatible with the framework.

Formally are not deprecated.

All legacy classes were re-engineered to support generic in JDK5.

Pratically are not deprecated, but there are other classes more appropriate.

Legacy = heritage of old java version.




回答2:


Early versions of java did not include Collections framework. Instead it defined several classes and one interface to store objects. When collection came these classes reengineered to support the Collection interfaces. These old classes are known are legacy classes. Vector is one of them. Others are Dictionary,HashTable,Properties, Stack

In this context, legacy means "should not be used anymore in new code". But you can if you want. And as they are not deprecated yet, they will be there for now at least.



来源:https://stackoverflow.com/questions/21086307/what-are-the-legacy-classes-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!