![]() It is used to create a vector with the same elements which are present in the collection. It accepts two parameters size and increment parameters to specify the initial capacity and the number of elements to allocate each time when a vector is resized for the addition of objects. It is used to create a vector of specified capacity. It accepts size as a parameter to specify the initial capacity. It is used when we want to create a default vector having the initial size of 10. Vector class provides the following four constructors: ![]() Vector implements Iterable after the release of JDK 5 that defines the vector is fully compatible with collections, and vector elements can be iterated by the for-each loop. The vector class has several legacy methods that are not present in the collection framework. ArrayList is not synchronized while vector is synchronized. Vector is a special type of ArrayList that defines a dynamic array. The java.util package defines the following legacy classes: For supporting generic in JDK5, these classes were re-engineered.Īll the legacy classes are synchronized. So, classes and interfaces that formed the collections framework in the older version of Java are known as Legacy classes. ![]() After adding the Collection framework in JSE 1.2, for supporting the collections framework, these classes were re-engineered. In the early version of Java, we have several classes and interfaces which allow us to store objects. In the past decade, the Collection framework didn't include in Java.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |