Next: Interface Up: Discussion Previous: Comparisons

### Set Primitive Operations

The three set primitive operations (union, intersection, and difference) are binary operations which take arbitrary Collection objects as arguments, treat them as multisets, and return the result as a multiset.

Figure 3.23: The Set Primitive Operations

Figure 3.24: Set Primitives with Set and Sequence Operands

The example in Figure illustrates the three set primitive operations applied to multisets, while the more extensive example shown in Figure shows the treatment of sequences as sets during these operations. Note that the type of the object receiving the return value of each operation determines whether the result is a set or a multiset.