JS realizes ArrayList function

Source: Internet
Author: User

1.ArrayList Method Summary

Construction Method Summary ArrayList () constructs an empty list with an initial capacity of 10. ArrayList (collection<? extends e> c) constructs a list of elements that contain the specified Collection, arranged in the order in which they are returned by the Collection iterator.  ArrayList (int initialcapacity) constructs an empty list with the specified initial capacity. Method Summary Booleanadd (e) Adds the specified element to the tail of this list. Voidadd (int index, E Element) inserts the specified element into the specified position in this list. Booleanaddall (collection<? extends e> c) adds all elements in the Collection to the end of this list, in the order of the elements returned by the specified Collection iterator. Booleanaddall (int index, COLLECTION&LT;? extends e> c) Inserts all elements from the specified Collection into this list, starting at the specified location. Voidclear () Removes all elements from this list. Objectclone () returns a shallow copy of this ArrayList instance. Booleancontains (Object o) returns true if the specified element is contained in this list. voidensurecapacity (int mincapacity), if necessary, increase the capacity of this ArrayList instance to ensure that it can at least accommodate the number of elements specified by the minimum capacity parameter. Eget (int index) returns the element at the specified position in this list. Intindexof (Object o) returns the index of the specified element that first appeared in this list, or 1 if the list does not contain elements. Booleanisempty () returns True if no element is present in this list intlastindexof (Object o) returns the last specified element in this listThe index of the vegetarian, or 1 if the list does not contain an index. Eremove (int index) removes the element at the specified position in this list. Booleanremove (Object o) removes the specified element (if any) that first appears in this list. protected Voidremoverange (int fromIndex, int toindex) removes all elements in the list between FromIndex (inclusive) and Toindex (not included). Eset (int index, E Element) replaces the element at the specified position in this list with the specified element. Intsize () returns the number of elements in this list. Object[]toarray () returns an array containing all the elements in this list in the appropriate order (from the first to the last element). <T> T[]toarray (t[] a) returns an array containing all the elements in this list in the appropriate order (from first to last); The run-time type of the returned array is the run-time type of the specified array. Voidtrimtosize () Adjusts the capacity of this ArrayList instance to the current size of the list.


2.js realizes some functions




JS realizes ArrayList function

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.