Arraylist Vs Array Code Example


Example 1: Difference between Array vs ArrayList

Arrays are fixed size ArrayList's size auotomatically adjusted Arrays can hold primitives and object ArrayList can hold only objects Arrays can be multi dimensional ArrayList cannot be multi-dimentional Array is a build in data structure ArrayList is implementing class of List interface in Collection framework

Example 2: 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

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?