Vector
and Hashtable
claim to be threadsafe because they synchronize every
method.
- But, this does not mean that they are really safe.
- Is the following thread safe?
import java.util.*;
public synchronized void insertIfAbsent(Vector vector, Object object){
if (vector.contains(object)) {
return;
}
vector.add(object);
}