What are the differences between vector, arraylist, and arraylist?

Source: Internet
Author: User

What are the differences between vector, arraylist, and arraylist?

Sort list class

The listlist interface allows null Element. In addition, the values list provides additional get, remove, and insert methods at the beginning or end of the values list. The consumer list is not synchronized (not thread-safe ). Implement thread security: List list = Collections.synchronizedList( new  LinkedList(...)); Fast addition, deletion, and slow query. ArrayList class ArrayList implements an array of variable sizes. It allows null ArrayList is not synchronized. Slow addition, deletion, and fast query. Vector Vector thread security. Low Efficiency  The differences between ArrayList and Vector are as follows:
1. When the memory of ArrayList is insufficient, the default number is 50% + 1, and the Vector is doubled by default.
2. Vector provides the indexOf (obj, start) interface, which is not available in ArrayList.
3. Vector is thread-safe, but Vector is not used in most cases, because thread security requires greater system overhead.

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.