NSArrayand NSMutableArray --arrays are ordered sets of multiple objects. Accesses an object by specifying its location (that is, the index) in the array. The index of the first element in the array is 0 (0).
NSDictionaryand NSMutableDictionary --the dictionary stores its entries as key-value pairs; The key is a unique identifier, usually a string, and the value is the object you want to store. You can access the object by specifying the key.
NSSetand NSMutableSet --the collection stores a
Java provides us with a set of tool classes that allow us to manipulate collections, and the methods are static. Collections.sort () method, parameter:list Collection Object, this object with generics, is to ensure that the elements in the collection are comparable, so that the return value of the generic will be a special point, The default sort string, in alphabetical orderIf it is in Chinese, the default is to sort by ASCII encodingCustomize a com
integer value that can be indexed as an array, which is first enumerated to get the following result.(0.6+0.8+0.7+0.9)/4 //0.7499999999999999You can see that chrome above is the first to enumerate the potential array indexes.Integer calculation floating point typeFor the calculation of floating-point numbers, the floating-point numbers can be converted to integers and then converted back to floating-point numbers. The order in which integers are evaluated can be in any order. Therefore, the enu
1. The type of the collection to implement the Ienumerator,ienumerable interface to use foreach. The types of collections include the array ArrayList list Hastabale dictionary sortlist stack queue2.ArrayA. General array int[] a=new int[4];int []a=new int[4]{1,2,3,4};int[]a={1,2,3,4};B. Multidimensional array int[,] a=new int[2,3]; int[,] a={{1,2},{2,3}}C. Array of arrays int[][]a=new int[2][]; int a[][]={new int[]{1,2,3},new int[]{1,2,3,4}};2.ArrayLis
Generic collection classes non-generic collection classesGeneric Collection class: A strongly typed type, mainly refers to checking during code compilation. An object that is not a string type, such as LISTNon-generic collection classes: are weakly typed, and such collections do not check during compilation. Exceptions that can easily cause type conversions during traversal may involve type conversions. Arraylist,hashtable, wait.Generic Collection Cl
in the original order, since it is the original sort, it is obvious that tuples cannot have this method, because tuples are not modifiable.
123
x =[4, 6, 2, 1, 7, 9]x.sort()printx #[1, 2, 4, 6, 7, 9]
What if you need a sorted copy and keep the original list intact?
12345
x = [ 4 , 6 2 1 7 9 ] y = x[:] y.sort () print y #[1, 2, 4 , 6, 7, 9] print x #[4, 6, 2, 1, 7, 9]
Note: y = x[:] Copies all the elements
existing object when the lookup succeeds.Common collections and genericsQ:int[] is a reference type or a value typeArray types are family types, all of which inherit from System.Array, and System.Array inherit from System.Object. All array types are reference types.Q: How to convert between arraysAn array type can be implicitly converted if the array dimension must be the same, the target project type and the source project type must have an implicit
Parallel Programming-Concurrent Collections, concurrentparallel
Memo: thread security collection class on the asp.net platform.
Class
Description
BlockingCollection
Provides blocking and bounding capabilities for thread-safe collections that implement IProducerConsumerCollection
ConcurrentBag
Represents a thread-safe, unordered collection of objects.
In addition to the thread-safe collections of the. NET concurrent series, sometimes we can have custom implementations, such as using locks, but this causes concurrency to degrade. This article uses the Interlocked class to implement thread-safe queuing.First define a helper class node, which will act as an element in the queue.Private class node{ public T Value; Public Node Next; Public Node (T value) { = value; }} Wh
1: Put an odd number in one array into a collection, then put an even number in another collection, and eventually merge the two collections into a single collection, and the odd numbers appear on the left and the even to the right.Ideas:(1) Determining the parity of elements in an array, assigning values to 2 sets, respectively(2) Declaring the third set, passing in the odd and even 2 sets separately | | Add another collection directly with one of th
Java Training,Android training,IOS Training,. Net Training , look forward to communicating with you! Collection technology:An important technology for "batch data" management, an alternative technology for array technology!Comparison with array technology:Arrays: Provides only "storage space", but lacks a variety of data management measures!Collection: On the basis of the array, provide rich "properties" and "methods" to facilitate our access to the data, and do not limit the length!Typic
How to enable Software Collections (SCL) on CentOS)
Red Hat Enterprise Linux (RHEL) and CentOS, its community branch, provide a 10-year life cycle, meaning that each version of RHEL/CentOS will provide security updates for up to 10 years. Although such a long life cycle provides enterprise users with much-needed system compatibility and reliability, there is also a drawback: as the underlying RHEL/CentOS version approaches the end of the life cycle, c
* ** The container API Collection interface defines how to access a single object. Its Sub-interfaces define the storage methods and forms respectively. 1. List: the stored data is ordered and can be repeated. 2. set: the stored data is not ordered and cannot be duplicated. the Map interface defines A method used to store "key-value pairs". *** Collection a collection represents A group of objects, known as its elements. some collections allow duplica
The dictionary is unordered, but the OrderedDict class of collections provides us with an Ordered dictionary structure, which is a real Ordered + Dict, the following two examples are used to briefly understand the OrderedDict ordered dictionary in the collections module of Python: as the data structure name says, it records the order in which each key-value pair is added.
d = OrderedDict()d['a'] = 1d['b']
The deque structure can be viewed as an enhanced version of the built-in list structure and provides more powerful methods than queues. The following describes the deque dual-end queue structure in the collections module of Python through several small examples: deque is the abbreviation of double-ended queue. it is similar to list, but it provides insert and delete operations on both ends.
Appendleft is inserted on the left of the list.
Value o
Special Collections: Queue, Stack one, stack stack class: Advanced, no indexNew Stack ();1. Add data: Push: Pushes elements into the collectionSs. Push (3); SS. Push (5); SS. Push (7);2. Get the data:(1) Peek returns the object at the top of the stack without removing it (gets the value of the last entered element)Console.WriteLine (ss. Peek ()); // 7(2) Pop sets the elements together (read and remove)Console.WriteLine (ss. Pop ()); // 7 Console.Write
Element Node1.4.1 Attributes of the element node(1) attribute PropertiesElement.attributes//Returns all attribute nodes of the current element node Element.id//Returns the id attribute of the specified element, reads and writes Element.tagname//returns the uppercase tag name of the specified element element.innerhtml// Returns the HTML code that the element contains, reads and writes element.outerhtml//returns all the HTML code for the specified element node, including itself and all child elem
use of collections ArrayList and Hashtable in C #http://blog.csdn.net/linukey/article/details/42506819ArrayList:One.Precautions:1. You can specify the initial size of the ArrayList collectionvar list = new ArrayList (10);//accommodates 10 elementsIf you do not specify a size, the default size is 0, add one after 4, and then increment in multiples.2.ArrayList is a complex version of the array, ArrayList internally encapsulates an array of type Object,
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.