Collection.st
changeset 25374 c5178797ee0c
parent 25273 87ad8bae24e5
equal deleted inserted replaced
25373:f030619565e1 25374:c5178797ee0c
   294 
   294 
   295 withAll:aCollection
   295 withAll:aCollection
   296     "return a new Collection with all elements taken from the argument,
   296     "return a new Collection with all elements taken from the argument,
   297      aCollection"
   297      aCollection"
   298 
   298 
   299 "/ Doesn't work with Iterator:
   299     ^ (self newWithCapacity:aCollection size)
   300 "/    ^ (self newWithCapacity:aCollection size)
       
   301 
       
   302     ^ self new
       
   303         addAll:aCollection;
   300         addAll:aCollection;
   304         yourself.
   301         yourself.
   305 
   302 
   306 
   303 
   307     "
   304     "
   308         OrderedCollection withAll:#(1 2 3 4 5 6)
   305         OrderedCollection withAll:#(1 2 3 4 5 6)
       
   306         Array withAll:#(1 2 3 4 5 6)
   309         Set withAll:#(1 2 3 4 5 6)
   307         Set withAll:#(1 2 3 4 5 6)
   310         StringCollection withAll:#('line1' 'line2' 'line3')
   308         StringCollection withAll:#('line1' 'line2' 'line3')
   311         String withAll:#($a $b $c)
   309         String withAll:#($a $b $c)
   312         Set withAll:(Iterator on:[:whatToDo | 1 to:10 do:[:i | whatToDo value:i]]).
   310         Set withAll:(Iterator on:[:whatToDo | 1 to:10 do:[:i | whatToDo value:i]]).
   313     "
   311     "
   314 
   312 
   315     "Modified (comment): / 09-11-2017 / 07:03:53 / stefan"
   313     "Modified (comment): / 09-11-2017 / 07:03:53 / stefan"
       
   314     "Modified (comment): / 28-04-2020 / 16:18:53 / Stefan Vogel"
   316 !
   315 !
   317 
   316 
   318 withSize:n
   317 withSize:n
   319     "obsolete: please use newWithSize:, for its better name"
   318     "obsolete: please use newWithSize:, for its better name"
   320 
   319