Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

ArrayList vs Vector

ArrayList is not thread safe/syncronized
Vector is thread safe/syncronized
ArrayList is faster than Vector
Both allow duplicate values and keep ordering
Both are implementations of List interface
Comment

arraylist vs vector in java

ArrayList is not thread safe
Vector is thread safe/syncronized
ArrayList is faster than Vector
Both allow duplicate values and keep ordering
Both are implementations of List interface
Comment

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

PREVIOUS NEXT
Code Example
Java :: Hash map, Hash set and Hash Table difference 
Java :: main method in java 
Java :: java check if int 
Java :: java max value between two numbers 
Java :: java set operations 
Java :: use of randomAccessfile() in java 
Java :: Programme to calculate Combination 
Java :: How to return the elements of a matrix in spiral order, in Java? 
Java :: how to get string input line in java 
Java :: stringbuilder java 
Java :: how to find armstrong numbers in java 
Java :: how to convert iso-8859-1 to utf-8 in java 
Java :: BodyContentImpl memory leak 
Java :: Java Access PriorityQueue Elements 
Java :: Missing artifact com.sun.jersey:jersey-servlet:jar:1.20-SNAPSHOT 
Java :: pop back stack fragment android 
Java :: generate random number in java within a range without repeating with android studio 
Java :: erstelle hashmap java 
Java :: infinite value total 
Java :: java check if year is leap 
Java :: count true in matrix java 
Java :: java create an instance of a stack 
Java :: get host from request object java 
Java :: for loop condition java 
Java :: arc() method from the processing library 
Java :: Explain try & catch finally block in Java 
Java :: binary search algorithm in java 
Java :: java empty array list vs null elements 
Java :: multiple representations of the same entity are being merged 
Java :: java list iterator example 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =