A
ankur
Hi All,
I did not understand why do we need to use the Decorators for
Collections for thread safety ?
so if I have a Collection c
why can't I just do:
synchronized(c) {
//do something on the collection c
}
for thread safety, rather than having to do instead
Collection sync_c = Collections.synchronizedCollection(c);
synchronized(sync_c) {
//do something on the collection sync_c
}
Thanks,
Ankur
I did not understand why do we need to use the Decorators for
Collections for thread safety ?
so if I have a Collection c
why can't I just do:
synchronized(c) {
//do something on the collection c
}
for thread safety, rather than having to do instead
Collection sync_c = Collections.synchronizedCollection(c);
synchronized(sync_c) {
//do something on the collection sync_c
}
Thanks,
Ankur