“Daftar Tertaut vs Daftar Array vs Vektor” Kode Jawaban

Daftar Tertaut vs Daftar Array vs Vektor

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

Daftar Tertaut Vektor vs

- LinkedList not synchronized, doubly linked
- Vector is synchronized, thread safe
Obedient Ocelot

Jawaban yang mirip dengan “Daftar Tertaut vs Daftar Array vs Vektor”

Pertanyaan yang mirip dengan “Daftar Tertaut vs Daftar Array vs Vektor”

Lebih banyak jawaban terkait untuk “Daftar Tertaut vs Daftar Array vs Vektor” di Java

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya