RFR: [6904367]: (coll) IdentityHashMap is resized before exceeding the expected maximum size (original) (raw)
Ivan Gerasimov ivan.gerasimov at oracle.com
Tue Jul 8 01:12:37 UTC 2014
- Previous message: RFR: [6904367]: (coll) IdentityHashMap is resized before exceeding the expected maximum size
- Next message: RFR: [6904367]: (coll) IdentityHashMap is resized before exceeding the expected maximum size
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 08.07.2014 4:47, Martin Buchholz wrote:
I think this code has an off-by-factor-of-2 bug.
+ if (expectedMaxSize > MAXIMUMCAPACITY / 3) + return MAXIMUMCAPACITY;
No, even though it looks like a bug.
(MAXIMUM_CAPACITY / 3) * (3 / 2) == MAXIMUM_CAPACITY / 2.
if expected size > MAXIMUM_CAPACITY / 3, then the minimum capacity must be > MAXIMUM_CAPACITY / 2 then the minimum capacity == MAXIMUM_CAPACITY.
- Previous message: RFR: [6904367]: (coll) IdentityHashMap is resized before exceeding the expected maximum size
- Next message: RFR: [6904367]: (coll) IdentityHashMap is resized before exceeding the expected maximum size
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]