Dictionary.st
changeset 24620 9a36839ff573
parent 24502 af543de49215
child 24728 8ba84cdb9121
equal deleted inserted replaced
24619:37f1256b4281 24620:9a36839ff573
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 1991 by Claus Gittinger
     4  COPYRIGHT (c) 1991 by Claus Gittinger
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
   917         message to the receiver with each of the keys and elements in
   919         message to the receiver with each of the keys and elements in
   918         dictionary in turn.  If a key in dictionary is key equivalent
   920         dictionary in turn.  If a key in dictionary is key equivalent
   919         to a key in the receiver, the associated element in dictionary
   921         to a key in the receiver, the associated element in dictionary
   920         replaces the element in the receiver.
   922         replaces the element in the receiver.
   921 
   923 
   922      Returns the argument, aCollection (sigh).
   924      Returns the argument, aCollection.
   923 
   925 
   924      WARNING: do not add elements while iterating over the receiver.
   926      WARNING: do not add elements while iterating over the receiver.
   925               Iterate over a copy to do this."
   927               Iterate over a copy to do this."
   926 
   928 
   927     self ~~ aCollection ifTrue:[
   929     self ~~ aCollection ifTrue:[
  1844      Obsolete: use keysDo: for ST-80 compatibility."
  1846      Obsolete: use keysDo: for ST-80 compatibility."
  1845 
  1847 
  1846     <resource:#obsolete>
  1848     <resource:#obsolete>
  1847 
  1849 
  1848     self obsoleteMethodWarning:'please use #keysDo:'.
  1850     self obsoleteMethodWarning:'please use #keysDo:'.
  1849     ^ self keysDo:aBlock
  1851     self keysDo:aBlock
  1850 
  1852 
  1851     "Modified: 20.4.1996 / 11:22:01 / cg"
  1853     "Modified: 20.4.1996 / 11:22:01 / cg"
  1852 !
  1854 !
  1853 
  1855 
  1854 associationsCollect:aBlock
  1856 associationsCollect:aBlock
  1966     "perform the block for all associations in the collection.
  1968     "perform the block for all associations in the collection.
  1967      Since dictionary does not define any order of its elements,
  1969      Since dictionary does not define any order of its elements,
  1968      this is the same as #associationsDo: here.
  1970      this is the same as #associationsDo: here.
  1969      Provided for protocol compatibility with OrderedDictionary"
  1971      Provided for protocol compatibility with OrderedDictionary"
  1970 
  1972 
  1971     ^ self associationsDo:aBlock
  1973     self associationsDo:aBlock
  1972 
  1974 
  1973     "Created: 28.2.1997 / 16:08:52 / cg"
  1975     "Created: 28.2.1997 / 16:08:52 / cg"
  1974 !
  1976 !
  1975 
  1977 
  1976 associationsSelect:aBlock
  1978 associationsSelect:aBlock
  2224 
  2226 
  2225 valuesDo:aBlock
  2227 valuesDo:aBlock
  2226     "perform the block for all values in the collection.
  2228     "perform the block for all values in the collection.
  2227      Same as #do: - for VisualWorks compatibility"
  2229      Same as #do: - for VisualWorks compatibility"
  2228 
  2230 
  2229     ^ self do:aBlock
  2231     self do:aBlock
  2230 !
  2232 !
  2231 
  2233 
  2232 xor:aCollection
  2234 xor:aCollection
  2233     "return a new set containing all elements,
  2235     "return a new set containing all elements,
  2234      which are contained in either the receiver or aCollection, but not in both."
  2236      which are contained in either the receiver or aCollection, but not in both."
  2261 !Dictionary methodsFor:'printing & storing'!
  2263 !Dictionary methodsFor:'printing & storing'!
  2262 
  2264 
  2263 printElementsDo:aBlock
  2265 printElementsDo:aBlock
  2264     "redefined, so #printOn: prints associations"
  2266     "redefined, so #printOn: prints associations"
  2265 
  2267 
  2266     ^ self associationsDo:aBlock
  2268     self associationsDo:aBlock
  2267 
  2269 
  2268     "Created: / 20.1.1998 / 14:11:02 / stefan"
  2270     "Created: / 20.1.1998 / 14:11:02 / stefan"
  2269 !
  2271 !
  2270 
  2272 
  2271 storeOn:aStream
  2273 storeOn:aStream