Dictionary - Description


The generic class Dictionary has two type parameters, K - the key type, and T - the data type. The generic class Dictionary exists in the namespace calculus (in assembly calculus.jar).

When creating a dictionary Dictionary<K,T>, the key class K is expected to be comparable. There are two ways in which the comparator for class K can be specified:

  1. the class K may derive from Comparator of K or
  2. the constructor Dictionary - Comparator may be used to manually specify the comparator.

The declaration of the dictionary class (in Java) is shown below.

public class Dictionary<K, T> implements Iterable<KeyValue<K, T>>,
                                         Serializable

Searches, insertions and removals are O(log2n).