>Here is the updated webrev: >http://cr.openjdk.java.net/~igerasim/6904367/2/webrev/
There is another bug with the initial implementation: if put throws, the element is still put (and the size incremented accordingly), and if putting a new mapping after the throwing one, the table gets full and get()/put()/remove() become subject to infinite loop. (and my idea that size was not supposed to go past MAX_CAPACITY was false in that case :-) With the new implementation, if put throws, the map is not modified (not even modCount) so it doesn't get broken. For performance, maybe isolating the code in the "if" in a "int resizeAndPut(Object k, Object item, int len, int i) {...}" method would help, reducing put() bytecode size. Having put() find the last free slots in an almost-full table would most often require a lot of time, so I wonder if anyone would have hit any of these infinite loops in practice. -Jeff