The difference between the list and order form self-summary

The order table:
Import of java.util.ArrayList // ArrayList introducing some control method of
the sequence table: Support o (1) Random Access (subscript Access)
1 is not easily broken pieces
2. friendly cache
3. single data For, more space saving. (List: data, there are two reference)
either all the space, null space or
in the sequence table, the physical order of their logical order of each entry stored consistent
from the first item start visiting each table entry; may be direct access number in accordance with (subscript) entry.
A group of consecutive addresses a memory cell structure for storing data sequentially linear elements.

Import package required when creating the sequence table:
// <wrapper class reference type> variable type
the ArrayList <the Person> new new = the arrayList the ArrayList <> ();
the ArrayList <Interge>
// use herein reference type, can not be primitive type
int is basic types contained therein)

About list:
Import java.util.LinkedList
list: first to delete tail puncturing end inserted plug end time complexity is o (1)
in a large area continuously added a small space
if the data is large, the space required to reserve
list is a non-continuous, non-sequential logical order of the storage structure, the data elements are linked through pointers in the linked list order implemented, nodes can be dynamically generated at runtime on a physical storage unit. Each node consists of two parts: a data field storing data elements, and the other is stored under a node address pointer field. Table compared to the linear sequence structure, a complicated operation

Guess you like

Origin blog.51cto.com/14232658/2438666