Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a question about Bill Brogden's book's explanation about collections

 
david hu
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In Page 200 of Bill Brogden's book. It's said that in java 1.1 and earlier versions, most of the methods in the Vector, Hashtable, and stack classes were synchronized to prevent "simultaneous" modification by more than one Thread which could lead to unpredictable results. The new Collections classes do not use synchronization;instead, they throw a ConcurrentModificationException if more than one Thread tries to modify a Collection.
The problem is from Sun's document, I found even in Java 1.3 the Vector is synchronized.Following is pasted from jdk1.3 document.
"As of the Java 2 platform v1.2, this class has been retrofitted to implement List, so that it becomes a part of Java's collection framework. Unlike the new collection implementations, Vector is synchronized."
Can anyone give me a explanation?
David hu
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vector and Hashtable have always been synchronized and will always be, I guess...
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have said it yourself: the "new" Collection classes in Java 1.2 are not synchronized, however the "old" clases in Java 1.1 still are synchronized in Java 1.2
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic