Collection.st
branchjv
changeset 19229 c20beb908660
parent 19227 5e949760a4e8
parent 19222 a499f0ee26b7
child 19331 59f77658de07
equal deleted inserted replaced
19228:f2f3abaadcb4 19229:c20beb908660
  1607 
  1607 
  1608 asDictionary
  1608 asDictionary
  1609     "return a Dictionary with the receiver collection's elements,
  1609     "return a Dictionary with the receiver collection's elements,
  1610      using the original keys of the receiver as dictionary key.
  1610      using the original keys of the receiver as dictionary key.
  1611      Notice: this is redefined in Dictionary, where it returns the receiver. 
  1611      Notice: this is redefined in Dictionary, where it returns the receiver. 
  1612      Use asNewDictionary, if you intent to modify the returned collection.
  1612      Use asNewDictionary, if you intend to modify the returned collection.
  1613      See associationsAsDictionary if you already have a collection of associations"
  1613      See associationsAsDictionary if you already have a collection of associations"
  1614 
  1614 
  1615     |d|
  1615     |d|
  1616 
  1616 
  1617     d := Dictionary new.
  1617     d := Dictionary new:self size.
  1618     self keysAndValuesDo:[:k :v | d at:k put:v].
  1618     self keysAndValuesDo:[:k :v | d at:k put:v].
  1619     ^ d
  1619     ^ d
  1620 
  1620 
  1621     "
  1621     "
  1622      #(10 20 30 40 50 60 70 80 90) asDictionary 
  1622      #(10 20 30 40 50 60 70 80 90) asDictionary