Collection of Java arrays

Source: Internet
Author: User

I. ArrayList

1. The ArrayList is implemented in an array, and when a ArrayList object is generated using a constructor without parameters, an array of type object of length 10 is actually generated at the bottom
2. If the number of added elements exceeds 10, then the ArrayList layer will be reborn into an array, 1.5 times times the length of the original array +1, then copy the contents of the original array into the new array, and the subsequent additions will be placed in the new array. This procedure is repeated when the new array cannot accommodate the added element.
3. For the delete operation of the ArrayList element, the subsequent elements of the deleted element need to be moved forward, at a higher cost.
4. The collection can only be placed in the object reference, unable to place the native data type, we need to use the native data type wrapper class to join the collection.
5. The object type is placed in the collection, so the object type is taken out, so it must be converted to the true type using the coercion type conversion (the type to put in).

Collection of Java arrays

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.