--- a/Collection.st Thu Apr 05 14:53:52 2007 +0200
+++ b/Collection.st Thu Apr 05 14:55:08 2007 +0200
@@ -2971,6 +2971,30 @@
"
!
+includesAnyIdentical:aCollection
+ "return true, if the the receiver includes any elements of
+ the argument, aCollection; false if it includes none.
+ Use identity compare for comparing.
+ Notice: this method has O^2(N) runtime behavior and may be
+ slow for big receivers/args.
+ Think about using a Set or Dictionary.
+ Some speedup is also possible, by arranging highly
+ probable elements towards the beginning of aCollection,
+ to avoid useless searches."
+
+ aCollection do:[:element |
+ (self includesIdentical:element) ifTrue:[^ true].
+ ].
+ ^ false
+
+ "
+ #(1 2 3 4 5 6 7) includesAnyIdentical:#(1 2 3)
+ #('hello' 'there' 'world') includesAnyIdentical:#('hello' 'world')
+ #(1 2 3 4 5 6 7) includesAnyIdentical:#(7 8 9)
+ #(1 2 3 4 5 6 7) includesAnyIdentical:#(8 9 10)
+ "
+!
+
includesIdentical:anElement
"return true, if the argument, anObject is in the collection.
This compares using #== (i.e. object identity).
@@ -3130,7 +3154,7 @@
!Collection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.197 2006-10-13 11:04:40 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.198 2007-04-05 12:55:08 stefan Exp $'
! !
Collection initialize!