• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make a Arrylist object is syncronized?

 
Gurram Ravi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello All'
how u can make arrallist object is syncronized?
 
Satish Chilukuri
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ravi, welcome to the ranch!!

First of all this is in the wrong forum! This forum is for JSP related stuff and your question has more to do with core java.

Now to your question. I think what you meant was how to make operations on an ArrayList synchronized. The ArrayList methods as such are not synchronized. You can either write a wrapper class and synchronize the calls, or you can use the Vector class which has the same functionality as that of ArrayList, but its methods are synchronized
 
Manesh Kumar
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To synchronize the ArrayList, you can use.


Note this is will NOT return ArrayList instance. So you need to use List interface type after synchronizing.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic