Set and traverse frame parsing performance comparison

Scenes
interviews often asked questions about the collections framework, summarized as follows:

1 arrayList and LinkedList together to achieve what the interface? And the significance of implementation?

1)
ArrayList, inheritance AbstractList class and implements List, RandomAccess, Clonable, Serializable four interfaces.
LinkedList, inheritance AbstractSequentialList class and implements List, Deque, Clonable, Serializable four interfaces.
They all have in common is to achieve a List, Clone, Serialzable three interfaces.
2)
List interface provides common CRUD method.
Cloneable is a marker interface, this interface clones expressed support classes.
Serializable interface represents the current class supports serialization.
3) different (additional)
ArrayList inherited AbstractList class, and implements some AbstractList List of location-related operations (such as get, set, add, remove) , but does not support the addition and replacement. ArrayList bottom through the array is achieved.
ArrayList implement the interface RandomAccess, RandomAccess similar interfaces Cloneable is a marker interface, query tag data is the use of dichotomous or for traversal iterates over.

AbstractSequentialList LinkedList inherited class, which is a subclass of AbstractList, is different from another set of AbstractList CRUD, the bottom layer is accomplished by the iterator related operations, and collections LInkedList bottom is implemented by a double linked list, belonging to the set of sequential access type.
LinkedList interfaces implemented, the Deque a deque, LinkedList bottom is achieved by a double linked list, it is possible to stack and queue data structures.

Reference: https: //www.jianshu.com/p/bc5d1de14e9a

2 underlying arrayList and LinkedList to achieve the same and different?

What may throw an exception when 2 arrayList and LinkedList traverse?

What methods have traversed 3? Internally principle?

4 traversal methods compare various performance? And application scenarios?

Published 95 original articles · won praise 21 · views 10000 +

Guess you like

Origin blog.csdn.net/leinminna/article/details/104874547