WeakIdentitySet.st
changeset 111 9cdd0ed47f38
parent 94 649321db4b9a
child 159 514c749165c3
--- a/WeakIdentitySet.st	Thu Aug 11 23:38:13 1994 +0200
+++ b/WeakIdentitySet.st	Thu Aug 11 23:38:52 1994 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1994 by Claus Gittinger
               All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.1 1994-08-05 01:03:07 claus Exp $
+$Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.2 1994-08-11 21:38:52 claus Exp $
 '!
 
 !WeakIdentitySet class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.1 1994-08-05 01:03:07 claus Exp $
+$Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.2 1994-08-11 21:38:52 claus Exp $
 "
 !
 
@@ -53,8 +53,26 @@
 "
 ! !
 
+!WeakIdentitySet class methodsFor:'instance creation'!
+
+new
+    "return a new empty Set"
+
+    ^ self new:1
+! !
+
 !WeakIdentitySet methodsFor:'private'!
 
+goodSizeFor:arg
+    "return a good array size for the given argument.
+     Since WeakIdentitySets are mostly used for dependency management, we typically
+     have only one element in the set. Therefore use exact size for small sets
+     (instead of rounding up to the prime 11)."
+
+    arg <= 10 ifTrue:[^ arg].
+    ^ super goodSizeFor:arg
+!
+
 keyContainerOfSize:n
     "return a container for keys and values of size n.
      use WeakArrays here."
@@ -73,5 +91,3 @@
 
     self rehash
 ! !
-
-