File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes a question about Bill Brogden's book's explanation about collections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "a question about Bill Brogden Watch "a question about Bill Brogden New topic

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

david hu
Ranch Hand

Joined: Jul 20, 2001
Posts: 143
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

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

[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
I agree. Here's the link:
subject: a question about Bill Brogden's book's explanation about collections
It's not a secret anymore!