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 ! |