answersLogoWhite
Computer Programming
Java Programming
The Difference Between

What is difference between ArrayList and Vector?

626364

Top Answer

User Avatar
Wiki User
2010-03-02 16:58:29
2010-03-02 16:58:29

1)Synchronization: Vector is synchronized and arraylist are not. 2)Increment size: Vector can increment the size by double,arraylist can increment it by 50%.

2)The default size of vector has 10, arraylist have 0.

3)we can specify the increment size with the vector and with arraylist we can't.

4)Arraylist is very fast as it is non-synchronized.

345

Related Questions

User Avatar

Both of these types of Collections allow for a new instance to be created with the contents of another Collection. // This method will accept a Vector and return a new ArrayList which contains all elements of that Vector static ArrayList toArrayList(Vector v) { return new ArrayList(v); } // This method will accept an ArrayList and return a new Vector which contains all elements of that ArrayList static Vector toArrayList(ArrayList al) { return new Vector(al); }

User Avatar

In use they're almost identical. The only thing you, as the programmer, really need to know is that Vectors are thread-safe and ArrayLists are not.

User Avatar

Difference between pipelining and vector processing?

User Avatar

ArrayListThink of this as a growable array. It gives you fast iteration and fast random access. To state the obvious: it is an ordered collection (by index), but not sorted. You might want to know that as of version 1.4, ArrayList now implements the new RandomAccess interface-a marker interface (meaning it has no methods) that says, "this list supports fast (generally constant time) random access." Choose this over a LinkedList when you need fast iteration but aren't as likely to be doing a lot of insertion and deletion.VectorVector is a holdover from the earliest days of Java; Vector and Hashtable were the two original collections, the rest were added with Java 2 versions 1.2 and 1.4. A Vector is basically the same as an ArrayList, but Vector methods are synchronized for thread safety. You'll normally want to use ArrayList instead of Vector because the synchronized methods add a performance hit you might not need. And if you do need thread safety, there are utility methods in class Collections that can help. Vector is the only class other than ArrayList to implement RandomAccess.The only difference between the two is that Vectors are synchronized and hence threadsafe whereas ArrayLists are not. Otherwise they are both identical in terms of their features and usage.

User Avatar

ArrayListLinkedList1. ArrayList uses a dynamic array.1..Linked List uses doubly linked list.2. ArrayList is not efficient for manipulation because a lot of shifting is required.2.. LinkedList is efficient for manipulation

User Avatar

The superclass is the class from which the current class inherits.The subclass is the class which inherits from the current class.class ArrayList extends AbstractList {}Here AbstractList is the superclass of ArrayList and ArrayList is the subclass of AbstractList.

User Avatar

An array list contains primitive types, while an ArrayList contains objects. However, this does not mean that an ArrayList cannot hold integers. In fact, through auto-boxing, int are automatically converted into Integers before put into ArrayList. Another difference is that an array has a fixed number of items in it, while an ArrayList can grow or shrink. An ArrayList has its own methods from import java.util.ArrayList. For example, to retrieve an object in a certain location, you would use get(i). However, for an array you would have to access array[i]. Another difference is how you initialize it: ArrayList<String> theList = new ArrayList<String>(); compared to String[] theList = new String[i]; There are many difference, but ultimately, it is up to you to decide which one is easier to work with.

User Avatar

ArrayListThink of this as a growable array. It gives you fast iteration and fast random access. To state the obvious: it is an ordered collection (by index), but not sorted. You might want to know that as of version 1.4, ArrayList now implements the new RandomAccess interface-a marker interface (meaning it has no methods) that says, "this list supports fast (generally constant time) random access." Choose this over a LinkedList when you need fast iteration but aren't as likely to be doing a lot of insertion and deletion.VectorVector is a holdover from the earliest days of Java; Vector and Hashtable were the two original collections, the rest were added with Java 2 versions 1.2 and 1.4. A Vector is basically the same as an ArrayList, but Vector methods are synchronized for thread safety. You'll normally want to use ArrayList instead of Vector because the synchronized methods add a performance hit you might not need. And if you do need thread safety, there are utility methods in class Collections that can help. Vector is the only class other than ArrayList to implement RandomAccess.

User Avatar

the difference between resultant vector and resolution of vector is that the addition of two or more vectors can be represented by a single vector which is termed as a resultant vector. And the decomposition of a vector into its components is called resolution of vectors.

User Avatar

Yes. That is the chief reason for the difference between momentum (a vector) and kinetic energy (not a vector).

User Avatar

a vector drive is vertical, a scalar is horizontal.

User Avatar

vector is usually is the arthropodes carrying the parasites such as mosquitoes.

User Avatar

from the abstraction: list you go to the implementation details (concrete): arraylist,vector or linkedlist,circularlinkedlist and maybe more when somebody asks you for a special list in this case (queue) speciality 1 enqueue -add to botton speciality 2 dequeue - remove from top you are free to pick up arraylist,and/or linkedlist and/or circularlists and/or vector to implement your new specialized list called queue. and/or means you might want to combine as well

User Avatar

A vector carries the disease but doesn't show any symptoms.

User Avatar

carrier harbour a pathogen but vector itself does not harbour the pathogen itself

User Avatar

Equilibrant vector is the opposite of resultant vector, they act in opposite directions to balance each other.

User Avatar

An array has a fixed size, whereas the vector can grow in size as necessary.

User Avatar

One difference between scalar processors and vector processors is their startup times, with vector processors needing prolonged startup due to multiple tasks. Another difference is that scalar processors operate on only one point of data at a time.

User Avatar

Vector graphics are simple geometric shapes which can be combined to create more complicated graphics. When you blow up a vector graphic, the edges of each object within the graphic stay smooth and clean, which means its width and height can be increased or decreased (scaled) without the loss of quality. This makes vector graphics ideal for logos, sign making, maps, animations and graphic design in general, an example could be the Google logo. They are comprised of vectors, or paths (points connected by lines or curves) instead of dots.Bitmap images (raster images) are images made up of pixels which are structured in a grid. Pixels are picture elements, tiny squares of individual colour that come together and make up what you see. Because bitmaps are made of squares of colour, some of which are too small to see, it's impossible to increase their size without sacrificing image quality: this is called pixilation. As there can be vast amounts of pixels and are stored as individuals, the file sizes are much bigger than vector graphs, as they are individual images.

User Avatar

Difference between a vector and bitmap graphics is that a vector is a format of a drawing whereas bitmap is a format of a photo. * the advantages of a vector is that the drawing can be stretched to any size without ruining the quality and bitmap is faster to display .Bitmap graphics as being stored in a literal fashion, then Vector Graphics, stored representative are their opposites.

User Avatar

Zero is a number (a scalar quantity without unit) while zero vector (or null vector) is a vector quantity having zero magnitude and arbitrary direction.

User Avatar

yes, the magnitude of difference between two mutually perpendicular vectors is greater than magnitude of either vector..


Copyright © 2020 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.