jump to navigation

Difference between ArrayList and Vector? February 7, 2007

Posted by Allu in JAVA.
trackback
  • Internally, both the ArrayList and Vector hold onto their contents using an Array. A Vector defaults to doubling the size of its array, while the ArrayList increases its array size by 50 percent.
  • ArrayList doesn’t have a constructor for specifying the incremental capacity, where as Vector has a constructor to specify the initial capacity and incremental capacity.
  • Vector is synchronized where as ArrayList is not synchronized
Advertisements

Comments»

1. rajeshkumar - March 4, 2007

it is very good
thank you for good ansers

2. bsureshkumar - March 20, 2007

it is very useful answer thanks

3. D.charan Raj - March 28, 2007

I didnot understand the first point as u said that doubleing the size and 50 % increase

4. Prashant Reddy - April 27, 2007

Hello sir,

I am unable to understand the first point as u said that A Vector defaults to doubling the size of its array, while the ArrayList increases its array size by 50 percent . If possible plese describe it clearly

5. madan - May 11, 2007

Nice to see this answer, Thank you. Give more with examples ……

Regards
Madan

6. Madan - May 11, 2007

Hello Friends,

is there any fixed or default size array list or vector holds. If holds what is the size let me know. Is there any way to synchronize the ArrayList. In real time situatuins when we will use vector and when we will use ArrayList.

Regards
Madan

7. Erol - June 14, 2007

ArrayList doesn’t have a constructor for specifying the incremental capacity, where as Vector has a constructor to specify the initial capacity and incremental capacity.

this is wrong you can look at http://java.sun.com/j2se/1.4.2/docs/api/java/util/ArrayList.html

ArrayList constructor takes initial capacity as parameter

8. Erol - June 14, 2007

sorry I got it now…

9. prashath kumar - October 1, 2007

wat is the exact key differece between the array list and vector.

10. aravind - December 27, 2007

how to make arraylist synchronized?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: