OrderedCollection.st
changeset 1321 52e043fb7eaf
parent 1290 15ba3221b89b
child 1324 a9b510f110a6
--- a/OrderedCollection.st	Tue Apr 30 14:46:43 1996 +0200
+++ b/OrderedCollection.st	Tue Apr 30 17:39:28 1996 +0200
@@ -50,6 +50,41 @@
     [author:]
         Claus Gittinger
 "
+!
+
+examples
+"
+    using OC as a stack:
+                                                                        [exBegin]
+        |stack top|
+
+        stack := OrderedCollection new.
+
+        1 to:10 do:[:i |
+            stack add:i
+        ].
+
+        10 timesRepeat:[
+            top := stack removeLast.
+            Transcript showCr:top
+        ]
+                                                                        [exEnd]
+    using OC as a queue (you should use Queue right away ..):
+                                                                        [exBegin]
+        |queue dequeued|
+
+        queue := OrderedCollection new.
+
+        1 to:10 do:[:i |
+            queue addLast:i
+        ].
+
+        10 timesRepeat:[
+            dequeued := queue removeFirst.
+            Transcript showCr:dequeued
+        ]
+                                                                        [exEnd]
+"
 ! !
 
 !OrderedCollection class methodsFor:'instance creation'!
@@ -1310,5 +1345,5 @@
 !OrderedCollection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.47 1996-04-25 16:15:26 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.48 1996-04-30 15:39:28 cg Exp $'
 ! !