OrderedCollection.st
changeset 1321 52e043fb7eaf
parent 1290 15ba3221b89b
child 1324 a9b510f110a6
equal deleted inserted replaced
1320:e32b778b56a7 1321:52e043fb7eaf
    47     [see also:]
    47     [see also:]
    48         Array
    48         Array
    49 
    49 
    50     [author:]
    50     [author:]
    51         Claus Gittinger
    51         Claus Gittinger
       
    52 "
       
    53 !
       
    54 
       
    55 examples
       
    56 "
       
    57     using OC as a stack:
       
    58                                                                         [exBegin]
       
    59         |stack top|
       
    60 
       
    61         stack := OrderedCollection new.
       
    62 
       
    63         1 to:10 do:[:i |
       
    64             stack add:i
       
    65         ].
       
    66 
       
    67         10 timesRepeat:[
       
    68             top := stack removeLast.
       
    69             Transcript showCr:top
       
    70         ]
       
    71                                                                         [exEnd]
       
    72     using OC as a queue (you should use Queue right away ..):
       
    73                                                                         [exBegin]
       
    74         |queue dequeued|
       
    75 
       
    76         queue := OrderedCollection new.
       
    77 
       
    78         1 to:10 do:[:i |
       
    79             queue addLast:i
       
    80         ].
       
    81 
       
    82         10 timesRepeat:[
       
    83             dequeued := queue removeFirst.
       
    84             Transcript showCr:dequeued
       
    85         ]
       
    86                                                                         [exEnd]
    52 "
    87 "
    53 ! !
    88 ! !
    54 
    89 
    55 !OrderedCollection class methodsFor:'instance creation'!
    90 !OrderedCollection class methodsFor:'instance creation'!
    56 
    91 
  1308 ! !
  1343 ! !
  1309 
  1344 
  1310 !OrderedCollection class methodsFor:'documentation'!
  1345 !OrderedCollection class methodsFor:'documentation'!
  1311 
  1346 
  1312 version
  1347 version
  1313     ^ '$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.47 1996-04-25 16:15:26 cg Exp $'
  1348     ^ '$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.48 1996-04-30 15:39:28 cg Exp $'
  1314 ! !
  1349 ! !