On 7 May 2010 23:47, Lukas Renggli <reng...@gmail.com> wrote:
>> He had the idea that it would be nice to be able to add any object to a 
>> LinkedList, instead of just Link subclasses. (IIRC, 'like you can in Ruby' 
>> ;))
>>
>> So we added ValueLink as the common pattern for "A link with an object in 
>> it", which is now the default if you add an object which itself is not a 
>> link.
>>
>> Makes it much more convenient to actually use a LinkedList, ref. f.ex. the 
>> Stack implementation.
>
> LinkedList is used internally by the process scheduler to handle
> processes, I don't think that it is ment to be used as a public
> collection class. For probably all applications it is slower and uses
> more memory than an OrderedCollection.
>
+1.
OrderedCollection's addLast/removeFirst/removeLast, is enough to use
them as lists.

About performance, i am little concerned.
Linked lists is good , that is costs you a constant time for each new
element you adding.
While for OrderedCollections it vary depending on container state. In
most cases, it costs you as little as for linked lists, but when
contained is not big enough to hold all elements - then it has to grow
and consuming a lot more time comparing to adding a previous element.

> Lukas
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project@lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



-- 
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to