4.3 Class OrderedList

image_pdfimage_print

In this section, we introduce class Orderedlist, which is used in some of the examples in subsequent sections of this book. This section is intended as a reference section and may be skipped during a first reading.

Class OrderedList has the same attributes as class Set:

class OrderedList(class ElmType:< Object): 
   insert(e: ref ElmType): :::
   has(e: ref ElmType): :::
   remove(e: ref ElmType): :::
   :::

A set is characterised by only having one occurrence of a given element. A Set object does thus only have at most one occurrence of a givne element. An OrderedList on the other hand may have several occurrences of the same element. The elements are inserted in the order why are inserted into an OrderedList object.