Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What kind of collection is list collection?
What kind of collection is list collection?
The List collection includes the JavaList interface and all the implementation classes of the List interface. Elements in a list set are allowed to be repeated, and the order of elements is the order in which objects are inserted, similar to arrays in Java. Users can access the elements in the collection by using the index (the position of the element in the collection).

The most important feature of List is order; It ensures that elements are saved in a certain order. List adds a large number of methods to the collection, which enables it to insert and delete elements in the middle of the sequence. (only recommended for LinkedList. )

List can be a ListIterator object. You can not only insert and delete elements in the middle of the list, but also traverse the list in both directions.

Extended data

Linked list: Linked list is thread unsafe and sequential access is optimized. Inserting and deleting elements in the middle of the list is also inexpensive. Random access is relatively slow. (use ArrayList. )

In addition, it also has methods such as addFirst (), addLast (), getFirst (), getLast (), removeFirst () and removeLast () (these methods, interfaces and base classes are undefined), and it can be used as a stack, queue or bidirectional queue.

Baidu Encyclopedia -JAVA Collection Framework

Baidu encyclopedia -JavaList collection