You are supposed to program a new collection class called MultiValueDicationary.
You are assumed to be familiar with
Group size: 2 student working together using the XP (eXtreme Programming) disciplines
An ordinary Dictionary<TKey, TValue> maps keys to values: Each key maps to (at most) one value.
A MultiValueDictionary<TKey, TValue> maps keys to values, but each key maps to a set of values (set means no duplicates).
The MultiValueDictionary<TKey, TValue> is usefull in the dictionary part of a distributed file sharing system where a single file can be accessible on many IP adresses
File name | IP adresses |
---|---|
SomeMovie | 192.12.33.4, 188.3.2.4, 178.4.5.3 |
AnotherMovie | 192.12.33.4, 185.3.2.3 |
IllegalMovie | 188.3.2.4 |
YetAnotherMovie | 194.22.4.5 |
A MultiValueDictionary<TKey, TValue> is similar to a Map<TKey, ISet<TValue>>, but it is not exactly the same ...
Googling for MultiValueDictionary you can find various classes - despite the name these classe does not do what I want. Do not spend time on them!
Create a new Solution in Visual Studio. Name the Solution "MultiValueDictionary"
Create a class new
MultiValueDictionary<TKey, TValue> { private readonly IDictionary<TKey, ISet<TValue>> _data = new Dictionary<TKey, ISet<TValue>>(); ... }
You must make the following methods for MultiValueDictionar<TKey, TValue>. The methods must be make in exactly this sequence.
You must make the test before you make the metod!!!
Refer to the documentation for details on each method.
IEquatable<MultiValueDictionary<TKey, TValue>>
IEnumerable<KeyValuePair<TKey, ISet<TValue>>>
Refer to the documentation for details on each method.
Your class MultiValueDictionary<TKey, TValue> must be documented using Doxygen.
Many collection classes have a so-called copy constructor.
A copy constructor is a constructor which is another collection.
public MultiValueDictionary(MultiValueDictionary<TKey, TValue> other)
All the elemens of other
are copied to this
(the newly create object)