On Tue, Mar 9, 2010 at 03:59, Ulf Zibis <ulf.zi...@gmx.de> wrote: > In PriorityQueue: > > let's result newCapacity in 0xFFFF.FFFC =-4 > then "if (newCapacity - MAX_ARRAY_SIZE > 0)" ---> false > then Arrays.copyOf(queue, newCapacity) ---> ArrayIndexOutOfBoundsException
How could newCapacity ever become -4? Since growth is by 50%. But even 100% looks safe... > Am I wrong ? > > 2.) Why don't you prefer a system-wide constant for MAX_ARRAY_SIZE ??? This should never become a public API - it's a bug in the VM. I prefer the duplication of code to creating a new external dependency. Martin > -Ulf