Jan. 13, 2009
10:34 a.m.
I need to write a DoubleLinkedList, checking for LinkedList I saw add: link after: otherLink "Add otherLink after link in the list. Answer aLink." | savedLink | lastLink == otherLink ifTrue: [^ self addLast: link]. savedLink := otherLink nextLink. otherLink nextLink: link. link nextLink: savedLink. ^link. Why is savedLink needed ? Why not: lastLink == otherLink ifTrue: [^ self addLast: link]. link nextLink: otherLink nextLink. otherLink nextLink: link. ^link. Are there any hidden reason I don't see? -- http://blog.ofset.org/hilaire