java collection data structure

 

String[]: Array Fixed-length
  ArrayList<E>: Object[] Array implementation Fast query, fast insertion, slow deletion Ordered 1.5 times + 1 expansion


  LinkedList<E>: Entry<E> next, previous linked list implementation Fast insertion, fast deletion Orderly 1.5 times +1 expansion


  HashMap<K,V>: Array + linked list implements storage of data through key-value pairs, fast query, fast insertion, and fast deletion; if the keys are the same, replace the old value Unordered 2x expansion


  HashSet<E>: Implemented using HashMap<E,Object>, using key value, unordered, 2 times expansion
  LinkedHashSet inherits HashSet
  LinkedHashMap inherits HashMap


  TreeMap binary tree Insertion is slow, query is fast Ordered (key) The sorting of keys needs to provide
  
  the key K of the comparator HashMap: The hashcode of the key is used in hash(K.hashcode())
               The equals() method of the key is used in get().
      When using HashMap, if the key is an object, you need to override the hashcode() and equals() methods

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326027119&siteId=291194637