• Post Reply Bookmark Topic Watch Topic
  • New Topic

vector: synchronized data and synchronized method  RSS feed

 
Yan Zhou
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One SCJD textbook says:

Vector provides synchronized methods to access data, but vector itself is not synchronized data, and there is a big difference.

I do not see how they are different from a programmer 's viewpoint: since all methods are synchronized, the internal data integrity of a vector is always maintained.

What did I miss?
Thanks.
Yan
 
Rovas Kram
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a reference to an object that is contained by a Vector, you can modify the value of that object in an thread un-safe manner. The synchronization just protects the list so-to-speak not the content.
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They have some really strange and confusing ways of wording those questions. I bet they think they are clear too...
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!