Commonalities:
Ilist, list, And arraylist are generally generalized arrays, which are called collections in C. Different from general narrow arrays, they can store any type of things and be specified when declaring or assigning values. For example, if you write a class cake and want to have a structure to store many cake instances, you can use them.
Differences: In general, ilist and list can only store elements of the same type. For example, when declared as list <cake> cakes = new list <cake> (), you can only use an instance with cake. When an element is retrieved from the cakes variable, the cake type is obtained directly. You do not need to perform forced conversions, so the performance is better. If you want an 'array' to store various types of instances, such as cake, juice, and bread, use arraylist food = new arraylist (); note that it does not specify what type of elements it installs, so you can install them as needed ~ Of course, the benefits cannot be exhausted. When 'taobao' is used, it is troublesome. The elements in arraylist are of the object type by default. Therefore, forced conversion is required, which causes poor performance in big data.
The difference between ilist and list: In my understanding, ilist is an interface, and list is a definite class. Interface, of course, you need to implement its functions. If you want these functions to have their own characteristics, write a class for implementation! When the statement is made: ilist <type> KK = new your implemented class name <type> (); of course you can write it: ilist <type> KK = new list <type> (); It is equivalent to implementing ilist in list (in fact, this is defined in C # API) if you write a list <type> KK = new list <type> (), it means that your code, the functions that operate the list cannot be changed at all, and you have to follow the rules. You can use what you write.
Usage: The usage of the preceding three sets is similar to that of Java. If there is a list <cake> cakes addition, deletion, modification, and query method:
Cakes. add (cake T); // Add cakes. remove (INT index); // Delete cakes. remove (cake T); // Delete cakes [] = // modified data // query or modify
Note: reposted from Sina BlogHttp://blog.sina.com.cn/s/blog_6cb117430100o0ul.html