Java 中的遗留类是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21086307/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 06:28:53  来源:igfitidea点击:

what are the legacy classes in Java?

javacollections

提问by Ankit Lamba

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

我最近听说Vector is a Legacy class,然后我在一个网站上读到

Legacy classes are used to save Objects before Collections came.

遗留类用于在集合出现之前保存对象。

So, why these are not called Deprecatedclasses, why Legacy?

那么,为什么这些不称为Deprecated类,为什么Legacy

采纳答案by venergiac

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

遗留类和接口是在Java的早期版本中形成集合框架的类和接口,以及现在如何重组或重新设计。它们与框架完全兼容。

Formallyare not deprecated.

正式不被弃用。

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

所有遗留类都经过重新设计以支持 JDK5 中的泛型。

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

Pratically都不会被弃用,但也有其他类比较合适。

Legacy = heritage of old java version.

Legacy = 旧 Java 版本的遗产。

回答by A Paul

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

早期版本的 java 不包含 Collections 框架。相反,它定义了几个类和一个接口来存储对象。当集合出现时,这些类被重新设计以支持集合接口。这些旧类被称为遗留类。矢量就是其中之一。其他有字典、哈希表、属性、堆栈

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.

在这种情况下,遗留意味着“不应再在新代码中使用”。但如果你愿意,你可以。由于它们还没有被弃用,它们至少现在会存在。