Collection.st
changeset 21082 c8e0ef40bf6e
parent 21040 9f1f81cbf2b2
child 21089 d50f93ca9622
child 21143 89370f05de89
equal deleted inserted replaced
21081:7c7d1c059ce9 21082:c8e0ef40bf6e
  1614 !
  1614 !
  1615 
  1615 
  1616 asArrayOfType:arrayClass
  1616 asArrayOfType:arrayClass
  1617     "return a new instance of arrayClass with the collection's elements"
  1617     "return a new instance of arrayClass with the collection's elements"
  1618 
  1618 
  1619     |anIntegerArray 
  1619     |anArrayInstance 
  1620      index "{ Class: SmallInteger }" |
  1620      index "{ Class: SmallInteger }" |
  1621 
  1621 
  1622     anIntegerArray := arrayClass new:(self size).
  1622     anArrayInstance := arrayClass new:(self size).
  1623     index := 1.
  1623     index := 1.
  1624     self do:[:each |
  1624     self do:[:each |
  1625         anIntegerArray at:index put:each.
  1625         anArrayInstance at:index put:each.
  1626         index := index + 1
  1626         index := index + 1
  1627     ].
  1627     ].
  1628     ^ anIntegerArray
  1628     ^ anArrayInstance
  1629 !
  1629 !
  1630 
  1630 
  1631 asBag
  1631 asBag
  1632     "return a new Bag with the receiver collection's elements"
  1632     "return a new Bag with the receiver collection's elements"
  1633 
  1633