• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
 
I will suppress my every urge. But not this shameless plug:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic