Set - Description

The generic class Set is a balanced binary set. The generic has a single type parameter, T - the data type of the set. The generic class Set exists in the namespace calculus (in assembly calculus.jar).

When creating a set Set<T>, the key class T is expected to be comparable. There are three ways in which the comparator for class T can be specified:

  1. the class T may derive from Comparable of T or
  2. the class T may derive from comparable of T or
  3. the constructor Set - Comparator may be used to manually specify the comparator.

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

public class Set<T> implements Collection<T>

Searches, insertions and removals are O(log2n).

When for is applied to a set, the entries are presented in key order.