--- a/Coll.st Fri Jul 16 11:39:45 1993 +0200
+++ b/Coll.st Mon Oct 04 11:32:33 1993 +0100
@@ -98,12 +98,6 @@
!Collection methodsFor:'error handling'!
-errorNotFound
- "report an error that Object was not in the collection"
-
- self error:'Object is not in the Collection'
-!
-
errorNotKeyed
"report an error that keyed access methods are not allowed"
@@ -209,6 +203,16 @@
^ true
!
+includesAny:aCollection
+ "return true, if the the receiver includes any elements of
+ the argument, aCollection; false if it includes none"
+
+ aCollection do:[:element |
+ (self includes:element) ifTrue:[^ true].
+ ].
+ ^ false
+!
+
occurrencesOf:anElement
"return the number of occurrences of the argument, anElement in
the receiver"
@@ -417,6 +421,18 @@
aSortedCollection := SortedCollection sortBlock:sortBlock.
aSortedCollection addAll:self.
^ aSortedCollection
+!
+
+writeStream
+ "return a stream for writing onto the receiver"
+
+ ^ WriteStream on:self
+!
+
+readStream
+ "return a stream for reading from the receiver"
+
+ ^ ReadStream on:self
! !
!Collection methodsFor:'printing & storing'!
@@ -536,9 +552,9 @@
aStream nextPutAll:' new)'.
isEmpty := true.
self do:[:element |
- aStream nextPutAll:' add: '.
+ aStream nextPutAll:' add:('.
element storeOn:aStream.
- aStream nextPut:$;.
+ aStream nextPutAll:');'.
isEmpty := false
].
isEmpty ifFalse:[aStream nextPutAll:' yourself'].