Array vs ArrayList vs LinkedList vs Vector in java Array vs ArrayList 1. ArrayList is much better than Array, when the size need to be increased dynamically. Efficiency is possible with arrays. ArrayList permits null elements.
2. ArrayList has group of objects. Array it treated as an object.
LinkedList vs Vector 1. A vector is a growable array which can store many objects of different classes. A linked list is a linear list where each item has a link to the next item in the list. It can be used to implement queue or stack operations.
2. Array list is better than linked list for accessing elements. To search the 1000th element, array list can perform it in a jiffy. While Linked list need to search / crawl through from the first element.
3. Linked list is better than array list to perform insertion and deletion operations at arbitrary locations.
|