OrderedDictionary.st
changeset 15451 8be26a61d680
parent 15134 84e886ef6b5f
child 15534 808593c7efb3
equal deleted inserted replaced
15450:2d6de3f90129 15451:8be26a61d680
   602         aBlock value: (self at:key)
   602         aBlock value: (self at:key)
   603     ].
   603     ].
   604 !
   604 !
   605 
   605 
   606 keysAndValuesDo:aBlock
   606 keysAndValuesDo:aBlock
   607     "perform the block for all keys in the collection.
   607     "perform the block for all keys and values in the collection.
       
   608      Enumerate them in the order by which they were added.
   608 
   609 
   609      See also:
   610      See also:
   610         #associationsDo:   (which passes key-value associations)
   611         #associationsDo:   (which passes key-value associations)
   611         #keysAndValuesDo:  (which passes keys & values separately)
   612         #keysAndValuesDo:  (which passes keys & values separately)
   612         #do:               (which passes values only)
   613         #do:               (which passes values only)
   613 
   614 
   614      WARNING: do not add/remove elements while iterating over the receiver.
   615      WARNING: do not add/remove elements while iterating over the receiver.
   615               Iterate over a copy to do this."
   616               Iterate over a copy to do this."
   616 
   617 
   617     order do: [:key | aBlock value:key value:(self at: key)].
   618     order do: [:key | aBlock value:key value:(self at: key)].
       
   619 
       
   620     "Modified: / 26.6.1999 / 10:55:30 / ps"
       
   621     "Created: / 15.10.1999 / 16:49:31 / cg"
       
   622     "Modified: / 15.10.1999 / 16:53:50 / cg"
       
   623 !
       
   624 
       
   625 keysAndValuesReverseDo:aBlock
       
   626     "perform the block for all keys and values in the collection.
       
   627      Enumerate them in the reverse order from which they were added.
       
   628 
       
   629      See also:
       
   630         #associationsDo:   (which passes key-value associations)
       
   631         #keysAndValuesDo:  (which passes keys & values separately)
       
   632         #do:               (which passes values only)
       
   633 
       
   634      WARNING: do not add/remove elements while iterating over the receiver.
       
   635               Iterate over a copy to do this."
       
   636 
       
   637     order reverseDo: [:key | aBlock value:key value:(self at: key)].
   618 
   638 
   619     "Modified: / 26.6.1999 / 10:55:30 / ps"
   639     "Modified: / 26.6.1999 / 10:55:30 / ps"
   620     "Created: / 15.10.1999 / 16:49:31 / cg"
   640     "Created: / 15.10.1999 / 16:49:31 / cg"
   621     "Modified: / 15.10.1999 / 16:53:50 / cg"
   641     "Modified: / 15.10.1999 / 16:53:50 / cg"
   622 !
   642 !
   959 ! !
   979 ! !
   960 
   980 
   961 !OrderedDictionary class methodsFor:'documentation'!
   981 !OrderedDictionary class methodsFor:'documentation'!
   962 
   982 
   963 version
   983 version
   964     ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.40 2013-04-25 07:18:43 stefan Exp $'
   984     ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.41 2013-07-01 14:48:19 cg Exp $'
   965 !
   985 !
   966 
   986 
   967 version_CVS
   987 version_CVS
   968     ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.40 2013-04-25 07:18:43 stefan Exp $'
   988     ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.41 2013-07-01 14:48:19 cg Exp $'
   969 ! !
   989 ! !
   970 
   990