Fix HashMap/Hashtable/LinkedHashMap to not allow corruption of the shared table.

See the bug for an excellent description of the problem.

The test also tests ConcurrentHashMap, IdentityHashMap, and WeakHashMap,
even though they never had this bug.

Bug: https://code.google.com/p/android/issues/detail?id=48055
Change-Id: Id12880b1a40945c1a7a4c6bc3656b842aad78bf7