Vector and ArrayList
Vectors are thread-safe, but in most cases do not use vectors, because thread safety requires greater overhead.
Hashtable and HashMap
The methods in Hashtable are synchronous, and the methods in HashMap are not synchronized by default. In the context of multi-threaded concurrency, you can use Hashtable directly, but to use hashmap, you need to increase the synchronization process.
StringBuilder and StringBuffer
StringBuilder and StringBuffer are identical in that the former is multithreaded and the latter is single-threaded.
Stack inherits from Vector is also thread-safe.
A thread-safe collection can be created by java.util.Collections, such as: Connections.synchronizedset (set<t>); Connections.synchronizedlist (list<t>); Connections.synchronizedmap (Map<k, v>), and so on, its simple principle is that each method adds synchronized to ensure thread safety.
may not be added after all.
Thread-Safe Collection objects in Java