ArrayList, LinkedList and Vector relationships and differences

ArrayList:

  1. The logical order and are physically continuous linear sequence of Table
  2. Based on the arrays to implement

Vector:

  1. The logical order and are physically continuous linear sequence of Table
  2. Based on the arrays to implement

LinkedList:

  1. Continuous logical order but not necessarily physically contiguous linear sequence of Table
  2. Based on a doubly linked list to

contact:

  1.ArrayList, LinkedList and Vector are commonly List under the category collection
  2.ArrayList and Vector are achieved by an array, the method is based on similar
  3.ArrayList and Vector expanding problem there
  4.ArrayList all sizes and Vector default initialization for

the difference:

  It is 1.ArrayList expansion capacity becomes 1.5 times the original, becomes Vector expansion capacity of two times the original
  initialization 2.ArrayList delay loading is employed, when the primary element of the time will increase in size of the default initialization an array of values, initialization Vector employed to load immediately, when you create an object array size is created as the default
  3.ArrayList is thread safe, Vector is thread-safe. General use is not considered thread-safe situation ArrayList, high performance, thread-safe read Vector mutually exclusive, so the performance of low
  4.ArrayList and Vector support random access, LinkedList does not support random access, multi-query at the scene, ArrayList more suitable
  5.LinkedList add and delete operations for the time complexity is O (1), ArrayList increase of time complexity is deleted O (N), in the case of frequent additions and deletions, LinkedList more suitable for use

Guess you like

Origin blog.51cto.com/14233687/2470733