OrderedCollection.st
changeset 3 24d81bf47225
parent 2 6526dde5f3ac
child 5 67342904af11
equal deleted inserted replaced
2:6526dde5f3ac 3:24d81bf47225
    29 
    29 
    30 contentsArray   <Array>         the actual contents
    30 contentsArray   <Array>         the actual contents
    31 firstIndex      <SmallInteger>  index of first valid element
    31 firstIndex      <SmallInteger>  index of first valid element
    32 lastIndex       <SmallInteger>  index of last valid element
    32 lastIndex       <SmallInteger>  index of last valid element
    33 
    33 
    34 %W% %E%
    34 $Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.3 1993-10-13 00:16:51 claus Exp $
    35 written spring 89 by claus
    35 written spring 89 by claus
    36 '!
    36 '!
    37 
    37 
    38 !OrderedCollection class methodsFor:'instance creation'!
    38 !OrderedCollection class methodsFor:'instance creation'!
    39 
    39 
   354     "evaluate the argument, aBlock for every element in the collection."
   354     "evaluate the argument, aBlock for every element in the collection."
   355 
   355 
   356     contentsArray from:firstIndex to:lastIndex do:aBlock
   356     contentsArray from:firstIndex to:lastIndex do:aBlock
   357 !
   357 !
   358 
   358 
       
   359 keysAndValuesDo:aTwoArgBlock
       
   360     "evaluate the argument, aBlock for every element in the collection,
       
   361      passing both index and element as arguments."
       
   362 
       
   363     firstIndex to:lastIndex do:[:index |
       
   364         aTwoArgBlock value:index value:(contentsArray at:index)
       
   365     ]
       
   366 !
       
   367 
   359 collect:aBlock
   368 collect:aBlock
   360     "evaluate the argument, aBlock for every element in the collection
   369     "evaluate the argument, aBlock for every element in the collection
   361      and return a collection of the results"
   370      and return a collection of the results"
   362 
   371 
   363     |newCollection
   372     |newCollection