Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

which Collection Class is synchronied?

 
guo mark
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ara all Collection Class unsynchronied? or there are some synchronied and some unsynchronied?
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some are and some aren't. For example, ArrayList isn't synchronized while Vector is. Your best resource would be to check the API for whichever classes you're interested in.
Corey
 
guo mark
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
3x
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, specifically Vector and HashTable are synchronized. All the other collection classes are unsynchronized. However, you can obtain a synchronized wrapper for the collection classes via the Collections class; but the default implementations are all unsynchronized (except for Vector and HashTable)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic