Vector class in Java

Source: Internet
Author: User

Synchronization in Java means that multiple threads simultaneously access an object, variable, method,CodeWait,

Ensure that only the unique thread accesses the synchronized object (that is, the content repaired with synchronized ).This can also be done.

Solution: synchronization is to ensure that only one thread accesses the synchronization object at the same time,Ensure operation Synchronization

The thread sequence of the object, which is consistent with the sequence in which they send requests to access the synchronized object.Vector is the old version of jkd.

(In 1.0) a collection class,Because the vector is synchronized and the arraylist is not synchronized

The performance of vector is worse than that of arraylist.If you do not need to ensure synchronization, try to use arrylist,In

When synchronization is required, you can consider using vector(In fact, vector is not recommended for synchronization,

Java has a collection tool class collections, which can put an arraylist programming thread safely ).

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.