Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

linked list vs array list 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
Comment

vector vs linked list

- LinkedList not synchronized, doubly linked
- Vector is synchronized, thread safe
Comment

PREVIOUS NEXT
Code Example
Java :: type variable java 
Java :: minecraft fabric client message 
Java :: how to spilt the string with comma in jaav 
Java :: pdf intent does not have permission to launch 
Java :: java interface 
Java :: .jar window immediately closes on doubleclick 
Java :: springbootservletinitializer maven dependency 
Java :: does not have a NavController set on 2131231008 
Java :: isnumeric matches in java 
Java :: set gamemode of player spigot 
Java :: javafx list view does not update 
Java :: check if LinkedList is empyth java 
Java :: hwo to create a list of 1 to n nums in java list 
Java :: how to initialize main in java 
Java :: how to get the memory location of an object in java 
Java :: java regex for ip address 
Java :: onclick listview javafx 
Java :: switch en java 
Java :: transparent border of jtextfield in java 
Java :: Create EntityManager Hibernate 
Java :: how to call a static method in java 
Java :: Java read in 
Java :: java stream add to existing list 
Java :: radiogroup get selected item android 
Java :: java jbutton get background color 
Java :: Java 7. Converting List<List<Integer to int[][]: 
Java :: remove duplicates from arraylist in android 
Java :: java to c# converter 
Java :: string length java 
Java :: declare matrix in java 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =