java.util.LinkedList clear() improvement
gkorland at gmail.com
Thu Aug 27 05:41:17 PDT 2009
First, LinkedList by definition is not thread safe so there's no need
to care about concurrency.
Second this is what modCount is all about, preventing an iterator to
keep on working.
On Thu, Aug 27, 2009 at 3:35 PM, Carsten Otto
<otto at informatik.rwth-aachen.de> wrote:
> On Thu, Aug 27, 2009 at 03:31:13PM +0300, Guy Korland wrote:
> > It seems like linkedList.clear() can be easily fixed to O(1) instead of O(n).
> With your solution one would be possible to continue working (traversing)
> on an empty (read: emptied) list. I don't think this is desired.
> Best regards,
> Carsten Otto otto at informatik.rwth-aachen.de
> LuFG Informatik 2 http://verify.rwth-aachen.de/otto/
> RWTH Aachen phone: +49 241 80-21211
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> -----END PGP SIGNATURE-----
More information about the core-libs-dev