The difference between ArrayList, LinkedList and Vector's

The difference between ArrayList, LinkedList and Vector's

ArrayList, LinkedList and Vector regarded in an interview with the more common knowledge points.

1.1、ArrayList

ArrayList继承AbstractList抽象父类,实现了List接口(可以进行list操作)、RandomAccess(可随机访问)、Cloneable(可拷贝)、Serializable(可序列化)
  • Thread safe
  • The underlying implementation is an array ArrayList default initial capacity is 10, add half the original capacity expansion every time, that is 1.5x

1.2、LinkedList

LinkedList实现了List接口(可以进行list操作)、Deque接口(能够当做双向端队列使用)、Cloneable(可拷贝)、Serializable(可序列化)
  • Thread safe
  • Traversing the underlying implementation is a doubly linked list, can easily front / rear

1.3、Vector

Vector 是矢量队列,它是JDK1.0版本添加的类。继承于AbstractList,实现了List, RandomAccess, Cloneable这些接口
  • The bottom is an array, thread-safe
  • All methods are synchronized, there is a performance penalty
  • Initialization Vector length is 10, each time doubling the previous capacity expansion, which is to become a factor of two

    Overall: multi-purpose query ArrayList, additions and deletions multi LinkedList, multi-threaded use the Vector
    ArrayList slow additions and deletions is not absolute, the tail deletions ArrayList is fast, if you delete a middle position, then ArrayList faster.

Reference links:

Guess you like

Origin www.cnblogs.com/shaoyu/p/12035153.html