Lista de matriz vs vector
Compare Types of Lists in Java
ArrayList
(extends AbstractList implements RandomAccess, Cloneable, Serializable)
- is dynamic array
- accepts duplicate elements
- is non-synchronized
LinkedList
(extends AbstractSequentialList implements Deque, Cloneable, Serializable)
- is linked list data scructure
- accepts duplicate elements
- is non-synchronized
Vector
(extends AbstractList implements RandomAccess, Cloneable, Serializable)
- growable or dynamic array of objects
- similar to array, but can grow and shrink
- synchronized
- if getting/setting more, use arrayList
--dynamic array perofrms better for get/set
- if adding/removing more, use linkedList
--doubly linked list better for adding removing
- if multi-thread, use Vector over arrayList
--vector's synchronized nature better for multi-thread
- if not multi-threaded, arraylist better
--because it's not synchronized, thus faster
Ten Horizons