List of Java

Source: Internet
Author: User

1. Set of systems:

----------| Collection root interface for single-column collections

--------------| List if it is a collection class that implements the list interface, the collection class has the characteristics: orderly, repeatable.

--------------| Set if it is a set interface implementation of the collection class, the collection class has the characteristics: unordered, non-repeatable.

Order: The order of the set does not refer to the natural order, but refers to the sequence in which the elements are added in the same order.

Unique methods in the list interface:

Add to

Add (int index, E Element)

AddAll (int index, COLLECTION<? extends e> c)

Get:

Get (int index)

IndexOf (Object o)

LastIndexOf (Object o)

sublist (int fromIndex, int toindex)

Modify:

Set (int index, E Element)


Iteration

Listiterator ()

Import Java.util.arraylist;import Java.util.list;public class Demo01 {public static void main (string[] args) {//TODO auto-generated Method Stub list = new ArrayList (), List.add ("Zhang San"), List.add ("John Doe"), List.add ("Harry"), List.add ("Zhao Liu"), List.add ("Zhao Liu"); System.out.println ("Elements of the collection:" + list);}}

Execution results

Elements of the collection: [Zhang San, John Doe, Harry, Zhao Liu, Zhao Liu]

2.

List of Java

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.