What is the difference between arraylist and vector? What is the difference between hashmap and hashtable?
Arraylist and vector are mainly used in two aspects.
1. Synchronization: the vector is thread-safe, that is, synchronous, And the arraylist is a line.ProgramNot secure, not synchronous
2. Data growth: When we need to increase, the vector grows to the original training by default, while the arraylist is half of the original growth.
Hashmap and hashtable are mainly used in three aspects.
I. Historical Reasons: hashtable is based on the obsolete dictionary class, And hashmap is an implementation of the map interface introduced by Java 1.2.
2. Synchronization: hashtable is thread-safe, that is, synchronous, while hashmap is not secure or synchronous.
3. Value: Only hashmap allows you to use a null value as the key or value of a table entry.
Collection
Shortlist
│ Invalid parameter list
│ ├ Arraylist
│ Vector
│ Elastic Stack
Sorted set
Map
├ Hashtable
├ Hashmap
└ Weakhashmap
Collection is the most basic collection interface. A collection represents a group of objects, that is, elements of the collection)
Map provides key-to-value ing