code cleanup: use #contains/#conform instead of explicit loop
authorClaus Gittinger <cg@exept.de>
Fri, 13 Oct 2006 13:02:18 +0200
changeset 10090 af5b9428e8ae
parent 10089 833fffc641ef
child 10091 ad0bf1206ce0
code cleanup: use #contains/#conform instead of explicit loop
Set.st
--- a/Set.st	Fri Oct 13 13:01:35 2006 +0200
+++ b/Set.st	Fri Oct 13 13:02:18 2006 +0200
@@ -9,7 +9,6 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-
 "{ Package: 'stx:libbasic' }"
 
 Collection subclass:#Set
@@ -447,12 +446,7 @@
     aCollection size == self size ifFalse:[^ false].
     "/ same number of elements; since I am a Set, all of
     "/ of my elements must be in the other collection ...
-    self do:[:element |
-	(aCollection includes:element) ifFalse:[
-	    ^ false
-	]
-    ].
-    ^ true
+    ^ self conform:[:element | (aCollection includes:element)]
 
     "
      #(1 2 3 4 5) asSet = #(2 3 4 5 1) asSet
@@ -501,6 +495,7 @@
      d1 = d2     
     "
 
+    "Modified: / 13-10-2006 / 12:58:43 / cg"
 !
 
 hash
@@ -1057,17 +1052,10 @@
      for aCollection."
 
     aCollection size ~~ self size ifTrue:[
-	^ false
+        ^ false
     ].
 
-    aCollection do:[:e|
-	(self includes:e) ifFalse:[
-	    ^ false.
-	]
-    ].
-
-    ^ true.
-
+    ^ aCollection conform:[:e | (self includes:e)]
 
     "
       #(1 2 3) asSet sameContentsAs: #(1 2 3)
@@ -1078,10 +1066,7 @@
       #(1 2 3 #aa) asIdentitySet sameContentsAs: #(1 2 3 #aa)
     "
 
-
-
-
-
+    "Modified: / 13-10-2006 / 12:59:01 / cg"
 ! !
 
 !Set methodsFor:'visiting'!
@@ -1104,7 +1089,7 @@
 !Set class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.98 2006-09-18 19:48:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.99 2006-10-13 11:02:18 cg Exp $'
 ! !
 
 Set initialize!