• Post Reply 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

performance of vector and synchronized arrayList

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Difference b/w these 2.

List list = Collections.synchronizedList(new ArrayList());

now arraylist also Synchronized.




As we vector also synchronized and arraylist explicity we synchronized.

Is there any diff we see here??
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

srinivas sy wrote:Is there any diff we see here??


Probably not now, since Vector has been retro-fitted to implement the List interface (it didn't originally).

It is however possible that Vector's synchronization might be slightly more "refined". Collections.synchronizedList() simply wraps a List in an object that synchronizes ALL its methods, whereas Vector's might be a bit more "tailored" - but you basically have no way of knowing without looking at the source code.

However, as I pointed out in your other thread: Vector is a "legacy" class and, as such, its use it generally discouraged.

Winston
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic