501 |
} |
} |
502 |
|
|
503 |
// At this point, we add a new mapping. |
// At this point, we add a new mapping. |
|
size++; |
|
504 |
modCount++; |
modCount++; |
505 |
|
size++; |
506 |
table[h] = key; |
table[h] = key; |
507 |
table[h + 1] = value; |
table[h + 1] = value; |
508 |
return null; |
return null; |
538 |
int h = hash(key); |
int h = hash(key); |
539 |
if (table[h] == key) |
if (table[h] == key) |
540 |
{ |
{ |
|
size--; |
|
541 |
modCount++; |
modCount++; |
542 |
|
size--; |
543 |
Object r = table[h + 1]; |
Object r = table[h + 1]; |
544 |
table[h] = tombstone; |
table[h] = tombstone; |
545 |
table[h + 1] = tombstone; |
table[h + 1] = tombstone; |
600 |
for (int i = table.length - 1; i > 0; i -= 2) |
for (int i = table.length - 1; i > 0; i -= 2) |
601 |
if (table[i] == o) |
if (table[i] == o) |
602 |
{ |
{ |
603 |
|
modCount++; |
604 |
table[i - 1] = tombstone; |
table[i - 1] = tombstone; |
605 |
table[i] = tombstone; |
table[i] = tombstone; |
606 |
size--; |
size--; |
|
modCount++; |
|
607 |
return true; |
return true; |
608 |
} |
} |
609 |
return false; |
return false; |
736 |
throw new ConcurrentModificationException(); |
throw new ConcurrentModificationException(); |
737 |
if (loc == table.length || table[loc] == tombstone) |
if (loc == table.length || table[loc] == tombstone) |
738 |
throw new IllegalStateException(); |
throw new IllegalStateException(); |
|
size--; |
|
739 |
modCount++; |
modCount++; |
740 |
knownMod++; |
size--; |
741 |
table[loc] = tombstone; |
table[loc] = tombstone; |
742 |
table[loc + 1] = tombstone; |
table[loc + 1] = tombstone; |
743 |
|
knownMod++; |
744 |
} |
} |
745 |
} // class IdentityIterator |
} // class IdentityIterator |
746 |
|
|
882 |
private void readObject(ObjectInputStream s) |
private void readObject(ObjectInputStream s) |
883 |
throws IOException, ClassNotFoundException |
throws IOException, ClassNotFoundException |
884 |
{ |
{ |
885 |
|
s.defaultReadObject(); |
886 |
|
|
887 |
int num = s.readInt(); |
int num = s.readInt(); |
888 |
table = new Object[2 * Math.max(num * 2, DEFAULT_CAPACITY)]; |
table = new Object[2 * Math.max(num * 2, DEFAULT_CAPACITY)]; |
889 |
// Read key/value pairs. |
// Read key/value pairs. |
903 |
private void writeObject(ObjectOutputStream s) |
private void writeObject(ObjectOutputStream s) |
904 |
throws IOException |
throws IOException |
905 |
{ |
{ |
906 |
|
s.defaultWriteObject(); |
907 |
s.writeInt(size); |
s.writeInt(size); |
908 |
for (int i = table.length - 2; i >= 0; i -= 2) |
for (int i = table.length - 2; i >= 0; i -= 2) |
909 |
{ |
{ |