Java Programming Ideas Learning Note 11: Holding objects

Source: Internet
Author: User

First, the basic concept

1.collecction: A sequence of independent elements that obey one or more rules. Lists must hold elements in the order in which they are inserted; Set cannot have duplicate elements; queue determines the order in which objects are produced by queuing rules

2,map: Mapping table, a set of pairs of key-value pairs of objects, allowing the use of keys to find values

1  PackageHolding;2 ImportJava.util.*;3 4  Public classsimplecollection {5      Public Static voidMain (string[] args) {6collection<integer> C =NewArraylist<integer>();7          for(inti = 0;i < 10; i++){8 C.add (i); 9         }Ten          for(Integer i:c) { OneSystem.out.print (i + ",");  A         } -     } -  the}

Ii. Classification (pending edit)

Third, List

In the case of the linked list data structure in C/E + +, there are two kinds of physical storage structures, namely, array list and chain list, both of which have advantages and disadvantages.

1,ArrayList: Can randomly access its elements, because the array subscript can randomly access any element. However, if you want to insert or delete, you must move the element, so the insertion or deletion of elements is slower.

2.LinkedList: Because it is a chain-based data structure, inserting and deleting without moving a large number of elements, faster. But to access an element, you need to traverse the linked list, making it slower to access the element.

Java Programming Ideas Learning Note 11: Holding objects

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.