RFR: 8035584: (s) ArrayList(c) should avoid inflation if c is empty

Martin Buchholz martinrb at google.com
Fri Feb 21 22:56:43 UTC 2014

You should do <tt> -> code conversion separately, and do it pervasively
across the entire JDK.

This is not right.
+     * {@code
(o==null ? get(i)==null : o.equals(get(i)))}

ObElisp, avoiding the above bug:

(defun tt-code ()
  (query-replace-regexp "<\\(tt\\|code\\)>\\([^<>{}&@]+\\)</\\1>" "{@code

On Fri, Feb 21, 2014 at 2:41 PM, Mike Duigou <mike.duigou at oracle.com> wrote:

> Hello all;
> This changeset consists of two small performance improvements for
> ArrayList. Both are related to the lazy initialization introduced in
> JDK-8011200.
> The first change is in the ArrayList(int capacity) constructor and forces
> lazy initialization if the requested capacity is zero. It's been observed
> that in cases where zero capacity is requested that it is very likely that
> the list never receives any elements. For these cases we permanently avoid
> the allocation of an element array.
> The second change, noticed by Gustav Åkesson, involves the
> ArrayList(Collection c) constructor. If c is an empty collection then there
> is no reason to inflate the backing array for the ArrayList.
> http://cr.openjdk.java.net/~mduigou/JDK-8035584/0/webrev/
> I also took the opportunity to the <tt></tt> -> {@code } conversion for
> the javadoc.
> Enjoy!
> Mike

More information about the core-libs-dev mailing list