Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Is ArrayList thread-safe?

807589Dec 15 2008 — edited Dec 15 2008
Hello,

I'm working on a quite big game. I'd like to use 2 threads for it(one for game input and other one for repainting screen).

the "input" thread can remove or add elements to ArrayList,

and the "repainting" thread reads that elements.

I read that this may cause some problems when input thread changes the ArrayList when the repainting thread interator is reading them.

Should i use for this Vector(because it is thread-safe).

Thanks Juraj.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 12 2009
Added on Dec 15 2008
5 comments
1,526 views