• 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 wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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
reply
    Bookmark Topic Watch Topic
  • New Topic