Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

ArrayList & Vector

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi.

Difference between arraylist and vector is that, arraylist is synchronized where as vector is synchronized, in arraylist when the data added increases array size will increase, but in vector when initial size should be specified, if we add more data to it, it will double the size giving more allocations.

According to my knowledge, these are the diffrences i know.

Please tell me these differences are correct or not. If more differences are there, post those answers.

If arraylist is not synchronized, how we can do it synchronized.

If already list is there, what is the need of arraylist.

Thankyou.
 
Ranch Hand
Posts: 443
3
Eclipse IDE C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
RE : If arraylist is not synchronized, how we can do it synchronized.

Use the apporpiate synchronized collection decorator

i.e. static method synchronizedList in the Collections class
 
author
Posts: 23956
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not crosspost. It wastes people's time and effort, as we can't tell if a question has already been answered.

Anyway, since the beginner forum is more appropriate, I am closing this topic.

Henry
 
My, my, aren't you a big fella. Here, have a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    Bookmark Topic Watch Topic
  • New Topic