First, ArrayList collection
. Add () Adds an object to the element that is actually contained in the Arraylidt
. Insert () Inserts an element into the ArrayList at the specified index. can be inserted at any location
. Remove () Removes the first occurrence of a specific object from the ArrayList
. RemoveAt () Removes the element at the specified index of the ArrayList
. Count gets the elements that are actually contained in the ArrayList
. Contians () determines whether an element is in ArrayList
. IndexOf ()
. LastIndexOf ()
. Sort () is overloaded, sorting the elements in ArrayList or part of it, ascending
If you need to sort in descending order, after auto-arranging, the reverse instruction is awakened to the whole set. Reverse ();
Case:
1. Remove data, data index, sort, reverse order,
2, enter the number of people, enter the score of each person, the average, sorted and into descending order
Second, Stack collection
Stack is not indexed.
Advanced post-out, LIFO, an assignment, one value, in order.
. Count goes to the number of elements in the collection
. push () pushes the element one by one into the collection
Pop () pops a collection of elements
. Clear () empties the collection
Case:
1, only to view, not remove, and calculate the collection has several elements
Third, queue collection
FIFO, an assignment of one to one value, in order. (no index)
. Count takes the number of elements in the collection
. Enqueue into the queue collection
. Dequeue Out Queue Collection
. Clear to empty the collection
1. Calculate how many elements are in a set
C # collections and Special Collections