41 which can be used as elements of a linkedList. |
41 which can be used as elements of a linkedList. |
42 |
42 |
43 LinkedList does not care for storage; all it does is handling |
43 LinkedList does not care for storage; all it does is handling |
44 chained link elements, which must respond to #nextLink/#nextLink:. |
44 chained link elements, which must respond to #nextLink/#nextLink:. |
45 (i.e. any object which can do this, can be used as elements of a linked |
45 (i.e. any object which can do this, can be used as elements of a linked |
46 list). |
46 list). |
|
47 An abstract superclass for linkElements is Link; a concrete class is |
|
48 ValueLink, which holds a reference to some object. |
|
49 |
|
50 [warning:] |
|
51 Be careful when subclassing Link, since there is a big drawback, |
|
52 which may be overlooked by beginners: |
|
53 a Link element can only be in one LinkedList |
|
54 - adding the same element to another LinkedList |
|
55 will remove it from the first as a side effect. |
|
56 Therefore, NEVER simply add something to a linkedList (except for |
|
57 valueLinks) unless you know what you do. |
|
58 The ST-80 implementors probably wanted this behavior, to move |
|
59 processes from the waitingList to runLists and vice versa; |
|
60 however, literature seems to not point this out enough. |
47 |
61 |
48 Although LinkedList is a subclass of SequenceableCollection (and therefore |
62 Although LinkedList is a subclass of SequenceableCollection (and therefore |
49 supports indexed access via at:), you should be careful in using it or |
63 supports indexed access via at:), you should be careful in using it or |
50 other methods based upon at:. |
64 other methods based upon at:. |
51 The reason is that #at: walks the linkedlist to find the indexed element |
65 The reason is that #at: walks the linkedlist to find the indexed element |