| Author |
a question about Bill Brogden's book's explanation about collections
|
david hu
Ranch Hand
Joined: Jul 20, 2001
Posts: 143
|
|
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
Joined: Aug 26, 2001
Posts: 7610
|
|
Vector and Hashtable have always been synchronized and will always be, I guess... ------------------ Valentin Crettaz Sun Certified Programmer for Java 2 Platform
|
SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
|
 |
Jose Botella
Ranch Hand
Joined: Jul 03, 2001
Posts: 2120
|
|
|
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
|
SCJP2. Please Indent your code using UBB Code
|
 |
 |
|
|
subject: a question about Bill Brogden's book's explanation about collections
|
|
|