On 2016-11-01, M N wrote:

>> read never indicates EOF as it stands, I think we should return -1
>> rather than 0 when position equals size. WDYT?

> Yes, indeed the contract specifies to return -1 in this case so we
> should change this.

will do.

>>> In resize() method there is also a danger to overflow integer when
>>> we are close to Integer.MAX_VALUE - either sum pos + wanted or shift
>>> may cause this.

>> True. One fix would be to ensure position + wanted is cut to
>> Integer.MAX_VALUE in write (in case the sum turns negative) and in
>> resize set len to newLength if newLength > Integer.MAX_VALUE / 2.

> Allocation is an interesting topic in itself. I have looked at
> ArrayList allocation algorithm and I think they got it right.

> First there is more conservative approach to allocation growth - 1.5
> ratio instead of 2.0 as we use. Also there is an overflow handled.

> Take a look at ArrayList.grow() method. The question is how to use
> this approach not to violate any license/intellectual property?

Don't copy it. Really.

> In the meantime I have created a patch with additional constructors,
> javadocs and also simple examples for in-memory cases .

Many thanks, I've applied it.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to