April 2, 2015
7:33 a.m.
On Thu, Apr 2, 2015 at 8:30 AM, Joachim Tuchel <jtuchel@objektfabrik.de> wrote:
In general, removing from a Collection while iterating through it leads to undefined results. The same is true for adding.
That is a question of approach; apart from mentioned #copy I could also do something like ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ col := #(1 2 3 4 5) asOrderedCollection. [col isNotEmpty] whileTrue: [ col remove: col first ]. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if I had an Iterator I could also reset it after each change. What I am asking is what the best approach would be - I want do some processing for each item and remove it from the collection after it is done. Peter