• Post Reply Bookmark Topic Watch Topic
  • New Topic

ArrayList and Vector  RSS feed

 
Salman Mushtaq
Greenhorn
Posts: 27
Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone !
As i read many articles on coderanch about difference between vector and arraylist , after it i have some questions. First of all i tell what i learn may be it is true or not so please tell me can i am on the right way.
1) Vector is synchronized and used where we have multi-thread
2) Growth rate of vector is double and ArrayList have 50 % of array

Now my question is that what is Synchronization and what if default size of vector and arraylist , if default size is zero than how vector and arraylist growth ?
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Salman,

Vector is not used at all, save for legacy code.

You can find the answers to your question in the JavaDoc for the Vector and ArrayList classes.

For synchronization, read the Oracle tutorial: http://docs.oracle.com/javase/tutorial/essential/concurrency/index.html

 
Campbell Ritchie
Marshal
Posts: 56578
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephan van Hulst wrote: . . . Vector is not used at all, save for legacy code. . . .
Except where somebody in their infinite wisdom left it as a parameter type for these two constructors and forgot to overload it to take List as a parameter.
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, there's that -__-;
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!