[squeak-dev] The Trunk: Collections-topa.726.mcz

Levente Uzonyi leves at caesar.elte.hu
Tue Dec 6 21:25:31 UTC 2016

On Tue, 6 Dec 2016, Tobias Pape wrote:

> On 06.12.2016, at 21:23, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>> On Tue, 6 Dec 2016, tim Rowledge wrote:
>>>> On 06-12-2016, at 11:08 AM, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>>>> Is there any use of these lists? I mean besides process scheduling.
>>>> I can't imagine a use-case where I would use a LinkedList instead of an OrderedCollection (or another data structure).
>>> Anywhere that needs frequent adding and removing of items mid-list, or growing/shrinking. Saves constantly making a new array, copying gazillions of OOPs and possibly #become.
>> Using the current implementation, addition might be O(1) if you hold a reference to the internal list node, but removal is O(n) unless you maintain backwards pointers - aka make the list doubly-linked.
>> OrderedCollection is far superior in growing/shrinking (provided it's done at one of its ends), both in term of run time and memory usage, since it needs fewer objects.
> Yes.
> But sometimes you need a linked list.

Right. But whenever I do, I roll my own because
  - most of the time I need a doubly linked list (e.g. LRUCacheHeadNode and 
  - I already have a class hierachy to match, so I can't subclass 
LinkedList (see ODatedEntry in OCompletion, this is also a doubly linked 

> It is not that the trunk _should_ use it but that Squeak programmers _can_ use it.

There must be a reason why it's not being used in the Trunk. :)


> Let's not impose too much on the programmers. Linked lists are pretty standard :)
> Best regards
> 	-Tobias

More information about the Squeak-dev mailing list