The legacy classes and interfaces

As explained at. the start of this chapter, the original version of java.utll did not include the collections framework. Instead, it defined several classes and an interface that provided an ad has method of storing objects. With the addition of collections by Java 2, several of the original classes ware engineered to support the collection interfaces. Thus, they are fully compatible with the framework. While lasses have actually been deprecated, one has been rendered obsolete. Of course; where a collection duplicates the functionality of a legacy class; you will usually wart to use the collection for new code. In general. the legacy classes are supported because a large base of code exists that uses them, including code still used by the java. One other point: None of the collection classes are synchronized, but all the legacy
classes. are synchronized. This distinction may be important in some situations. Of course, you can easily synchronize collections, too, by using one of the algorithms provided by Collections.

The legacy classes defined by java.util are  shown here: Dictionary Hash table Properties * Stack Vector· There is one legacy interface called Enumeration. The following sections Enumeration and-each of the legacy classes, in turn.

Share This