OrderedCollection.st
changeset 679 d3165edbb098
parent 629 2ceefe9b5a19
child 1071 5875a6eedd28
equal deleted inserted replaced
678:723357b38138 679:d3165edbb098
   640 reverseDo:aBlock
   640 reverseDo:aBlock
   641     "evaluate the argument, aBlock for every element in the collection
   641     "evaluate the argument, aBlock for every element in the collection
   642      procesing elements in reverse direction (i.e. starting with the last)"
   642      procesing elements in reverse direction (i.e. starting with the last)"
   643 
   643 
   644     contentsArray from:firstIndex to:lastIndex reverseDo:aBlock
   644     contentsArray from:firstIndex to:lastIndex reverseDo:aBlock
       
   645 !
       
   646 
       
   647 keysAndValuesReverseDo:aTwoArgBlock
       
   648     "evaluate the argument, aBlock for every element in the collection,
       
   649      passing both index and element as arguments."
       
   650 
       
   651     |start  "{ Class:SmallInteger }"
       
   652      stop   "{ Class:SmallInteger }" |
       
   653 
       
   654     stop := lastIndex.
       
   655     start := firstIndex.
       
   656     stop to:start by: -1 do:[:index |
       
   657 	aTwoArgBlock value:index value:(contentsArray at:index)
       
   658     ]
       
   659 
       
   660     "
       
   661      #(10 20 30 40) asOrderedCollection keysAndValuesReverseDo:[:index :value |
       
   662 	Transcript show:index; show:' '; showCr:value
       
   663      ]  
       
   664     "
   645 ! !
   665 ! !
   646 
   666 
   647 !OrderedCollection methodsFor:'filling & replacing'!
   667 !OrderedCollection methodsFor:'filling & replacing'!
   648 
   668 
   649 replaceFrom:start to:stop with:aCollection startingAt:repStart
   669 replaceFrom:start to:stop with:aCollection startingAt:repStart
  1083 ! !
  1103 ! !
  1084 
  1104 
  1085 !OrderedCollection class methodsFor:'documentation'!
  1105 !OrderedCollection class methodsFor:'documentation'!
  1086 
  1106 
  1087 version
  1107 version
  1088     ^ '$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.38 1995-11-23 17:06:25 cg Exp $'
  1108     ^ '$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.39 1995-12-05 12:38:23 chrisy Exp $'
  1089 ! !
  1109 ! !