1.JAVA Set frame diagram
2. A general explanation of the architecture of the Java collection
list, set, and map are the three most important interfaces in this set system.
List and set inherit from collection interface
Set does not allow elements to be duplicated. HashSet and TreeSet are two main implementation classes
The list is ordered and allows elements to be duplicated. ArrayList, LinkedList, and vectors are the three main implementation classes.
The map also belongs to the collection system, but differs from the collection interface. A map is a collection of key pairs of value, where the key column is a collection. Key cannot be duplicated, but value can be repeated. HashMap, TreeMap, and Hashtable are the three main implementation classes.
3. What is the difference between ArrayList and vectors?
ArrayList The Add method:
Public BooleanAdd (e e) {ensurecapacityinternal (size+ 1); elementdata[size++] =e; return true;}
Vector's Add method: Public synchronized BooleanAdd (e e) {Modcount++; Ensurecapacityhelper (Elementcount+ 1); Elementdata[elementcount++] =e; return true;}
Conclusion: Vectors are thread-synchronized (synchronized), ArrayList are non-synchronous
So on the performance: ArrayList is better than vector
Java Collection Framework