![]() It can use the Iterator as well as enumeration to traverse the elements. ![]() Traversal(pass-through) It uses Iterator to traverse the elements. It is less preferred as synchronization in vectors causes inferior performance. Preference Programmers prefer ArrayList over vectors. If elements exceed their capacity then the vector increases 100% of the existing array size. Resizing If elements exceed their capacity then ArrayList increases 50% of the existing array size. Vector operations run slower as they are synchronized. Speed Its operations are fast as they are non-synchronized. Vector is synchronized i.e., only one thread could handle the code at a moment. You can not change the length of Array once created in Java but ArrayList re-size itself when gets full depending upon the capacity and load factor. ![]() Comparison Table Between ArrayList And Vector Parameters of Comparison ArrayList Vector Synchronization ArrayList is not Synchronized i.e., it could work on various threads simultaneously. 1) First and Major difference between Array and ArrayList in Java is that Array is a fixed-length data structure while ArrayList is a variable-length Collection class. It supports a dynamic array of elements which means the array is resizable.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |