SortedCollection.st
changeset 9918 1947f22681ef
parent 9917 278547f0d52e
child 9920 316e29a48e51
equal deleted inserted replaced
9917:278547f0d52e 9918:1947f22681ef
   263 sortBlock:aBlock withAll:aCollection
   263 sortBlock:aBlock withAll:aCollection
   264     ^ self withAll:aCollection sortBlock:aBlock
   264     ^ self withAll:aCollection sortBlock:aBlock
   265 ! !
   265 ! !
   266 
   266 
   267 !SortedCollection methodsFor:'accessing'!
   267 !SortedCollection methodsFor:'accessing'!
       
   268 
       
   269 largest:n
       
   270     "return the n largest elements"
       
   271 
       
   272     sortBlock == DefaultSortBlock ifTrue:[
       
   273         ^ ((OrderedCollection new:n) grow:n)
       
   274                 replaceFrom:1 with:self startingAt:(self size-n+1)      
       
   275     ].
       
   276     ^ super largest:n
       
   277 
       
   278     "
       
   279      #(10 35 20 45 30 5) asSortedCollection largest:3 
       
   280     "
       
   281 !
   268 
   282 
   269 max
   283 max
   270     "Return the largest element."
   284     "Return the largest element."
   271 
   285 
   272     sortBlock == DefaultSortBlock ifTrue:[
   286     sortBlock == DefaultSortBlock ifTrue:[
   875 ! !
   889 ! !
   876 
   890 
   877 !SortedCollection class methodsFor:'documentation'!
   891 !SortedCollection class methodsFor:'documentation'!
   878 
   892 
   879 version
   893 version
   880     ^ '$Header: /cvs/stx/stx/libbasic/SortedCollection.st,v 1.60 2006-09-18 09:01:58 cg Exp $'
   894     ^ '$Header: /cvs/stx/stx/libbasic/SortedCollection.st,v 1.61 2006-09-18 09:05:03 cg Exp $'
   881 ! !
   895 ! !
   882 
   896 
   883 SortedCollection initialize!
   897 SortedCollection initialize!