Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what are the legacy classes in Java? [closed]

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?

like image 310
earthmover Avatar asked Jan 13 '14 07:01

earthmover


People also ask

What are all legacy classes in collection?

They only contained some classes and an interface, which were used to store objects. These are called as Legacy classes and Legacy Interface. The Legacy classes are synchronized as opposed to the classes in the collection framework. The Legacy classes are Dictionary, Hashtable, Properties, Stack, and Vector.

Which of these are legacy classes?

Correct Option: D. Stack, Hashtable, Vector, Properties and Dictionary are legacy classes.


2 Answers

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.

like image 66
venergiac Avatar answered Oct 13 '22 00:10

venergiac


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.

like image 41
A Paul Avatar answered Oct 12 '22 23:10

A Paul