Second, List interface

Source: Internet
Author: User

List: Unique Common methods: there is a general characteristic is that all can operate the angle mark.

1, adding
void Add (index,element);
void Add (index,collection);


2, delete;
Object Remove (Index):


3, modify:
Object set (index,element);


4, Get:
Object get (index);
int IndexOf (object);
int LastIndexOf (object);
List sublist (from,to);

Note: An iterator that is unique to the 1.List collection. Listiterator is a sub-interface of iterator.

In an iteration, you cannot manipulate the elements in the collection through the methods of the collection object.
Because the concurrentmodificationexception exception occurs.

So, in iterators, you can only manipulate elements with iterators, but the iterator method is limited,
Only the elements can be judged, taken out, removed from the operation,
If you want other operations such as add, modify, and so on, you need to use its sub-interface, Listiterator.

This interface can only be obtained through the Listiterator method of the list collection.
The 2.List set determines whether the element is the same, based on the Equals method of the element.

Second, List interface

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.