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

Levente Uzonyi leves at caesar.elte.hu
Tue Dec 6 20:23:48 UTC 2016


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.

Levente

>
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Useful Latin Phrases:- Sic faciunt omnes. = Everyone is doing it.


More information about the Squeak-dev mailing list