>>>>> "Eric" == Eric Blake <[EMAIL PROTECTED]> writes:

Eric> Modified files:
Eric>   .              : AUTHORS ChangeLog 
Eric>   java/util      : HashMap.java Hashtable.java 

Eric>   * java/util/Hashtable.java (contains): check for null
Eric>   (Hashtable(Map)): more efficient
Eric>   (clear): more efficient
Eric>   (clone): more efficient, by adding Entry.copy

I think it is disputable whether these are really more efficient.

I'm not too concerned with `clear'.  In that case the new code may
very well be more efficient.  It is hard to say in a
platform-independent way.

But is the new clone really more efficient?  It turns a loop into a
recursive method call.  This call isn't even tail-recursive.  I'm
pretty sure this will be noticeably less efficient, at least when
compiled with gcj.  I'd be suprised if a method call is cheaper than a
loop in a JIT or interpreter.


Also, I have a very minor nit about the patch itself:

+    // if Hashtable is empty, this method doesn't dereference 
+    // `value' anywhere, so check for it explicitly.
+    if (value == null)
+      throw new NullPointerException();

In the GNU style, comments should be full sentences.  So this one
should start `If', not `if'.

Tom

_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to