Next: Interface
Up: Discussion
Previous: Comparisons
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
![\begin{figure}
\begin{flushleft}
\begin{minipage}[t]
{\textwidth}
\hrulefill
\v...
...nd{verbatim}
\vspace*{-6mm}
\hrulefill\end{minipage}\end{flushleft}\end{figure}](img68.gif) |
Figure 3.24:
Set Primitives with Set and Sequence Operands
![\begin{figure}
\begin{flushleft}
\begin{minipage}[t]
{\textwidth}
\hrulefill
\v...
...nd{verbatim}
\vspace*{-6mm}
\hrulefill\end{minipage}\end{flushleft}\end{figure}](img69.gif) |
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.
RHS Linux User
1/26/1998