Collections class has synchronized methods

Collections class has synchronized methods like synchronizedCollection,synchronizedSet,synchronizedList and so on that return a synchronized collection.

a) What is a synchronized collection that is returned here? What does it mean its synchronized when we still have to use #b below?

b) The collection returned by the above methods must again be accessed synchronously within a synchronized block, Does using Vector avoid this?

Please advice.

Thanks

Deepak

[494 byte] By [deepu-jaina] at [2007-11-27 8:49:40]
# 1

> a) What is a synchronized collection that is returned

> here?

What? Those methods returns a wrapper that is synchronized. The wrapper delegates the calls to the original collection (but does so from synchronized methods)

> What does it mean its synchronized when we

> still have to use #b below?

Why do you have to use b? Who says that?

> b) The collection returned by the above methods must

> again be accessed synchronously within a synchronized

> block,

Who says so?

> Does using Vector avoid this?

No

kajbja at 2007-7-12 20:59:11 > top of Java-index,Java Essentials,Java Programming...