Hi,
-----Message d'origine----- De : squeak-dev-bounces@lists.squeakfoundation.org [mailto:squeak-dev- bounces@lists.squeakfoundation.org] De la part de Michael van der Gulik Envoyé : samedi 30 juillet 2005 02:09 À : squeak-dev@lists.squeakfoundation.org Objet : Re: set and stream
Houssam Fakih wrote:
Hello,
Im trying to concatenate many collections (sets) together. I learn (from becks book) that the use of stream is efficient so I try the following code
write _ WriteStream on: Set new.
write nextPutAll: (Set with:4 with:5)
write contents
but it doesnt work because Set isnt a member of a SequenceableCollection then it doesnt understand the message : replaceFrom:to:with:startingAt:
Finally I try a code as:
write _ WriteStream on: {}.
write nextPutAll: (Set with:4 with:5)
write contents asSet
Im happy with the result but I need just to know if there is another pattern to use Set and Stream.
I'm not entirely sure what you're trying to do, but:
a := Set with: 1 with: 'a' with: #hello. b := Set with: 2 with: 'b' with: #world. c := Set new. c addAll: a. c addAll: b.
Is that what you want? Remember to look at the Set class and see what it can do.
[Fakih]
Thank you for your response. What I need is a method that does the same computation as addAll: with better performance. By using streams I improve the performance by 70%. My question was just to know if the developers on the list use another pattern (other than using streams) to improve that.
Thanks, Houssam
Mikevdg.