The difference and connection between the three ArrayList.LinkedList.Vector

Source: Internet
Author: User

This is a problem that you often encounter in an interview. Tell you to write about the difference between the three ArrayList.LinkedList.Vector: The original has been confused, do not know what the difference between the three. Hey, ashamed, the foundation is too bad Ah, Wood has a way ah

Now it's time to talk about the differences and connections between the three: these are all implemented the list interface, have the list interface definition of the method, and also has a collection interface method;

ArrayList: Using an array of methods to store data, query and modify the speed, but the increase and deletion speed is slow; threads are not synchronized

LinkedList: The use of a linked list to store data, query and modify the speed is slow, but the increase and delete faster

Vector: is also used in the way of array storage, vector used before java1.0, but ArrayList is used after the java1.2 version, the thread is synchronized, the efficiency is slower than ArrayList, and vector query data has an iterator , there are enumerations, there are get (int index), there are four ways of indexof (int index), while ArrayList does not enumerate

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.