Thread-Safe classes
In the collection framework, some of the classes are thread-safe, and these are all occurrences of jdk1.1. After the jdk1.2, there are many non-thread-safe classes. The following are the thread-safe classes of synchronization:
Vector: It's more of a synchronization mechanism (thread-safe) than ArrayList, because it's less efficient and it's not recommended anymore. In the Web application, especially the foreground page, the efficiency (page response speed) is often preferred.
STATCK: Stack class, advanced post-out
Hashtable: It's a thread-safe more than HashMap.
Enumeration: enumeration, equivalent to an iterator
In addition to these, the others are non-thread-safe classes and interfaces.
Thread-safe classes whose methods are synchronous, can only have one access at a time. is a heavyweight object with low efficiency.
Other:
1. The difference between Hashtable and HashMap
Hashtable is thread-safe, that is, the Hashtable method provides a synchronization mechanism, HASHMAP is not thread-safe, that is, does not provide a synchronization mechanism; Hashtable does not allow null values to be inserted, hashmap allow!
2. How to modify a collection with multithreading concurrency
With the old Vector/hashtable class
StringBuffer is thread safe, and StringBuilder is thread insecure. For security and insecurity without deep understanding of the situation, it is easy to create such an illusion, if the operation of StringBuffer is thread-safe.
Those classes in the Java collection are thread-safe