Tag:java use data re c ar
The collection of Java is just a few general:list,set,map (all interfaces are implemented by their subclasses)
Arraylist,linkedlist,vector all belong to List
List: The elements are ordered, and the elements can be repeated because each element has its own corner label (index)
|-- arraylist: The underlying data structure is an array structure, characterized by: query fast, add Delete A little bit slower, the thread is out of sync
|-- linkedlist: The underlying use of the linked list data structure, characterized by: Delete quickly, query slow.
|--vector: The underlying is the array data structure, thread synchronization, is replaced by the ArrayList, now use only his enumeration.
Set: The element is unordered and cannot be duplicated (the order in which it is stored and fetched does not necessarily coincide), the thread is out of sync.
|--hashset: The underlying is a hash table data structure. Determines the uniqueness of an element according to the hashcode and equals methods
|--treeset: You can sort the elements in the set collection (naturally sequential), and the underlying data structure is a two-fork tree, You can also write a class to implement the comparable or Comparator interface, define your own comparator, and pass it as a parameter to the TreeSet constructor.
Map: This collection is a store of key-value pairs, one to the other, and to ensure that the key uniqueness (01, Zhang San) is printed out in the form of 01= Zhang San
|-- HashTable: The underlying is a hash table data structure that cannot be stored in a null key and a null value, which is synchronous and less efficient. Appears in JDK1.0
|--hashmap: The underlying is a hash table data structure that can be stored in NULL keys and null values, threads are out of sync, efficient, instead of Hashtable, appearing in jdk 1.2
|--treemap: The underlying is a two-fork tree data structure, threads are out of sync, and can be used to sort keys in a map collection