LIST
(1) List is a sub-interface of collection
Features: Orderly (the storage sequence and the order of removal), repeatable.
(2) Unique traversal capabilities of the list collection
A: Combined by size () and get ().
Example:
for (int x=0; x<list.size (); x + +) {
String s = list.get (x);
System.out.println (s);
}
(3) The unique function of the list iterator; (listiterator)
It can be traversed in reverse, but it must be traversed first and seldom used.
Sub-class features of list
ArrayList
The underlying data structure is an array , query fast, and delete slowly.
Threads are unsafe and highly efficient.
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.
Threads are unsafe and highly efficient.
ArrayList and vectors
The ArrayList and vector classes encapsulate a dynamic object[] array that allows redistribution. The ArrayList and Vector objects use the initialcapacity parameter to set the length of the array, and their initialcapacity automatically increases when the elements added are beyond the length of the array to be changed.
LinkedList
A: Has a unique function
A: Add
AddFirst ()
AddLast ()
B: Delete
Removefirst ()
Removelast ()
C: Get
GetFirst ()
GetLast ()
Common data structures
A: Stack advanced back out
B: Queue FIFO
C: Array query fast, adding and deleting slow
D: List query slow, and delete fast
Java Basics (vi)---list