Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

linked 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 :: osmdroid get current zoom level 
Java :: Button loginButton = new Button(this); loginButton.setText("Login"); Button register Button = new Button(this); register Button .gettext("Register"); 
Java :: java get year difference between two dates 
Java :: android java change text value 
Java :: java compare lists 
Java :: how to convert integer to string in java 
Java :: bulkwrite mongodb array of objects 
Java :: how to create a subclass in java 
Java :: app not showing in share menu android 
Java :: java bogosort 
Java :: Odd or even program in java using a mod operator 
Java :: java binary search 
Java :: is the function same as method in java 
Java :: draw triangle in android studio xml 
Java :: what is static method in oop 
Java :: current port used by the Java application 
Java :: Java Hashmap Replace Elements 
Java :: binary search algorithm in java 
Java :: difference between two sets java 
Java :: Java Find the greatest common divisor of two positive integers. The integers can be large, so you need to find a clever solution. 
Java :: where to use findviewbyid in fragment 
Java :: Palindrome Program in Java. 
Java :: is c# similar to java 
Java :: polymorphism in java 
Java :: remove element from char array java 
Java :: arrays with for loops 
Java :: double to int 
Java :: android recyclerview pull to refresh 
Java :: java collectors mapping 
Java :: android how to know when snackbar is done 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =