classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: classpath ./AUTHORS ./ChangeLog java/util/HashM...


From: Tom Tromey
Subject: Re: classpath ./AUTHORS ./ChangeLog java/util/HashM...
Date: 17 Sep 2001 09:31:55 -0600

>>>>> "Eric" == Eric Blake <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]