--- a/Set.st Fri Sep 15 12:30:55 2000 +0200
+++ b/Set.st Fri Sep 15 12:31:31 2000 +0200
@@ -894,6 +894,35 @@
"
#(0 1 2 3 4 5 6 7 8 9) asSet - #(1 2 3)
"
+!
+
+intersect:aCollection
+ "return a new set containing all elements of the receiver, which are
+ also contained in the argument collection"
+
+ |newCollection|
+
+ newCollection := self species new.
+ aCollection do:[:element |
+ (self includes:element) ifTrue:[
+ newCollection add:element
+ ]
+ ].
+ ^ newCollection
+
+ "
+ #(0 1 2 3 4 5 6 7 8 9) asSet intersect:#(1 2 3 11)
+ "
+
+
+
+
+
+
+
+
+
+
! !
!Set methodsFor:'testing'!
@@ -991,6 +1020,6 @@
!Set class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.66 2000-08-30 21:24:57 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.67 2000-09-15 10:31:31 stefan Exp $'
! !
Set initialize!