BagMap - Description

The generic class BagMap is a hash table of entries with support for duplicated key entries. The generic has two type parameters, K - the key type, and T - the data type. The generic class BagMap exists in the namespace Calculus (in assembly Calculus.dll).

When creating a map BagMap<K,T>, the key class K is expected to be equality comparable. There are two ways in which the comparer for class K can be specified:

  1. the class K may derive from IEquatable of K or
  2. the constructor BagMap - Comparer may be used to manually specify the equality comparer.

The declaration of the map class (in C#) is shown below.

public class BagMap<K, T> : IEnumerable<KeyValue<K, T>>,

Maps are serializable (interface ISerializable) and using the binary formatter, a map may be written to a file or other media.

Several definitions of the most important concept 'map' are possible. The definition adopted by Calculus is that a map separates the keys and the data. BagMap has an indexer.

The class BagMap is an unordered collection. When foreach is applied to a map, the entries are presented in random order. A similar but ordered concept is the class BagDictionary.