140826 ● set

Source: Internet
Author: User

Set

The difference between a set and an array: a set can be discontinuous and multiple data types.

 

Value, address, and address of the next element

 

. Count count the number of elements in the Set

. Add () add element

. Addrange () adds a group of elements (such as an array)

. Remove () Remove the value in the first ()

. Removeat () removes an element according to the subscript in ().

. Insert (0th) insert an element at the position

. Insertrange (,) inserts a group of elements in position X.

. Clear () Clear the set

Position of the first occurrence of an element in. indexof () (-1 if no element exists)

Position of the last element in. lastindexof ()

Elements in the. Sort set are sorted in ascending order.

. Reverse () inversion

 

Int [] A = new int [5] {1, 2, 3, 4, 5 };

Foreach (INT n in a) // generally, foreach is used to traverse arrays and sets, which is efficient.

{

Console. writeline (N );

}

 

System. Threading. thread. Sleep (1000); // you can put it in the for statement to slow down the loop and reduce it by 1000 milliseconds.

 

 

Stack (Advanced and later)

Stack S = new stack ();

. Push () Push Value

. Pop-up value

. Clear () Clear

 

Team (first-in-first-out)

Queue q = new Queue ();

. Enqueue () into the value

. Dequeue () to retrieve the value

. Clear () Clear

 

 

Garbage collection:

The system enables garbage collection: 1. idle time and garbage collection; 2. When the memory usage is full, garbage collection is enabled.

Arraylist

 

140826 ● set

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.