The difference between ArrayList and LinkedList

Source: Internet
Author: User

Reprint Source: Link

List Overview

Let's take a look at the list in the collection frame chart:

From the diagram we can see that:

1. List is an interface that inherits from the collection interface and represents an ordered queue.

2. Abstractlist is an abstract class that inherits from Abstractcollection. Abstractlist implements methods other than size (), get (int location) in the list interface.

3. Abstractsequentiallist is an abstract class that inherits from Abstrctlist. Abstractsequentiallist implements the "All methods of the list, which manipulate the list according to the index value."

4. ArrayList, LinkedList, vector, and stack are the four implementation classes in the list, where the vector is based on JDK1.0, although it achieves synchronization, but is inefficient and no longer used, stack inheritance and vector, so don't repeat.

5. LinkedList is a two-way linked list that can also be used as a stack, queue, or two-terminal queue. the difference between ArrayList and LinkedList

We know that in general, the difference between ArrayList and LinkedList has the following points:

1. ArrayList is a data structure based on dynamic array, and LinkedList is based on the data structure of the linked list;

2. For random access to get and set,arraylist is better than LinkedList, because linkedlist to move the pointer;

3. For adding and removing operations Add and remove, people generally say linkedlist is faster than ArrayList, because ArrayList to move the data. But the reality is not so, for add or delete, LinkedList and ArrayList does not specify who fast who slow

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.