Summary of collection collection in 1.Java
Collection
|---List (stored in order, repeatable)
|---ArrayList
The underlying data structure is an array, query fast , and delete slowly.
Thread insecurity, high efficiency
|---Vector
The underlying data structure is an array, query fast, and delete slowly.
Thread-safe, low-efficiency.
|---linkedlist
The underlying data structure is linked list, query slow, delete quickly.
Thread insecure, high efficiency
|---Set (stored unordered, element unique)
|---HashSet
The underlying data structure is a hash table.
Relying on the hashcode () and Equals () two methods to ensure the uniqueness of the element, the development of the use of development tools automatically generated just fine.
|---linkedhashset
The underlying data structures are linked lists and hash tables
Chain List guarantees orderly elements
Hash table guaranteed Element unique
|---TreeSet
The underlying data structure is a red-black tree.
How do you ensure that elements are sorted? Natural sort or comparator sort.
How do you ensure that elements are unique? Judging by whether the comparison results are zero.
Map
|---HashMap
The bottom is the array list, using the hash algorithm to ensure that the element storage location
|---linkedhashmap
|---TreeMap
The bottom layer is the red and black tree implementation.
Summary of common data structures in collections
ARRAYXXX: The underlying data structure is an array, query fast, and delete slowly
LINKEDXXX: The underlying data structure is linked list, query slow, and delete quickly
HASHXXX: The underlying data structure is a hash table. Dependent on two methods: Hashcode () and Equals ()
TREEXXX: The underlying data structure is a two-fork tree. Sort by two ways: natural sort and comparator sort
The difference between collection and collections?
1.Collection is the top-level interface of a single-column collection with two sub-interfaces list and set
2.Collections is a tool class that operates on a collection and can be sorted and looked up
Java Collection, Map Collection Summary