c++,c#,java,oc容器类对比

xiaoxiao2021-02-28  77

1.c++:

vector<T>

deque<T>:高效的前后插入,删除的vector

list<T>

map<T,T>:内存小,红黑树,查找慢Olog(n)   vs hash_map<T.T>:内存大,hashtable,查找快O(1)

set<T>,hash_set<T>

以下会与c++作对比,<Object>为无范型,<T>为有范型

2.c#

Array:[]

Arraylist:vector<Object>

list<T>:vector<T>

Linkedlist:list<T>

hashset:hash_set<T>

hashtable:hash_map<Object>

Dictionary:map<T,T>

3.java

ArrayList<T>:vector<T>

Linkedlist<T>:list<T>

hashmap<T,T>:hashmap<T,T>

treemap<T,T>;map<T,T>

hashset<T>:hash_set<T>

treeset<T>:set<T>

4.oc

Array:[]

MutableArray:vector<Object>

Dictionary:[]

MutableDictionary:map<Object>

Set:[]

MutableSet[]:set<Object>

转载请注明原文地址: https://www.6miu.com/read-74191.html

最新回复(0)