2/02/2010

Collection Framework in .Net/Java/C++

Collection framework is an essential part of modern programming platform library and it's used in daily coding work as developer. But C++, Java and .Net use different terms to represent collection concepts, if you have to switch your coding environment among these platforms, you may feel confused sometimes.

In this article, I will try to summarize those collection framework related terms and concepts in each platform and give a uniformed taxonomy table for convenient referencing.


-->
C++
Java
.Net
List
Array Backed
[unsynchronized]
[synchronized]
Link Backed
[link list backed]
Deque
[var array backed]
[opt-bounded link list backed]
[link list backed]
N/A
Queue
[fix array backed]
[var array backed]
[unbounded link list backed]
[unbounded q with delaying]
[opt-bounded link list backed]
[opt-bounded link list backed]
[unbounded link list backed]
[unbounded, ordered]
[var array backed, ordered]
[a rendezvous channel]
Stack
Set
[ordered, tree indexing]
[ordered, hash indexing]
[ordered, skip list backed]
[CopyonWriteArraylist backed]
[compact, ordered]
[hash table backed]
[hash table with insert order link]
[TreeMap backed, sorted]
[Has Math Set Operations]
Map
[thread-safed hash map]
[skiplist backed, sorted]
[compact sorted]
[unsynchronized]
[synchronized]
[hash map with double links in insertion order]
[Red Black tree indexing, sorted]
[hash map using weak keys]
[var array indexing]
[var array indexing]
[hash indexing]
[hash indexing]
[binary tree indexing]
[link list indexing]
[hash and var array indexing]
Bit


From the upper table, it's clear that .Net lag far behind Java in terms of collection framework, especially when thread contention and synchronization are considered. In my personal perspective, the most critical problem of .Net collection framework is its lacking of well considered design - the name convention is in chaos and misleading, limited flexible implementations of each collection interface.

[Reference]
Java
01. wiki on Java Collection
02. Java Collection Tutorial
03. Java Collection Documentation

.Net
11. System.Collections
12. System.Collections.Generics
13. System.Collections.Specialized

C++
21. STL summary
22. STL in VC++

No comments: