Bugs in java.util.ArrayList, java.util.Hashtable and java.io.ByteArrayOutputStream

Martin Buchholz martinrb at google.com
Tue Mar 9 22:08:46 UTC 2010


On Tue, Mar 9, 2010 at 13:08, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
>
> [1] current PriorityQueue snippet:
> ...
>         int newCapacity = ((oldCapacity < 64)?
>                            ((oldCapacity + 1) * 2):
>                            ((oldCapacity / 2) * 3));
> ...
> [2] new PriorityQueue snippet:
> ...
>         int newCapacity += (oldCapacity < 64) ?
>                            oldCapacity : oldCapacity / 2;
> ...

Thanks, I took your suggestion and changed it to:

        int newCapacity = oldCapacity + ((oldCapacity < 64) ?
                                         (oldCapacity + 2) :
                                         (oldCapacity >> 1));


Martin



More information about the core-libs-dev mailing list