jdk/src/share/classes/java/util/IdentityHashMap.java
changeset 58 55e9cd9ade0b
parent 51 6fe31bc95bbc
child 65 51fc1d79463f
equal deleted inserted replaced
57:bde819c390e0 58:55e9cd9ade0b
     1 /*
     1 /*
     2  * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Sun designates this
     7  * published by the Free Software Foundation.  Sun designates this
   747                 throw new ConcurrentModificationException();
   747                 throw new ConcurrentModificationException();
   748 
   748 
   749             expectedModCount = ++modCount;
   749             expectedModCount = ++modCount;
   750             int deletedSlot = lastReturnedIndex;
   750             int deletedSlot = lastReturnedIndex;
   751             lastReturnedIndex = -1;
   751             lastReturnedIndex = -1;
   752             size--;
       
   753             // back up index to revisit new contents after deletion
   752             // back up index to revisit new contents after deletion
   754             index = deletedSlot;
   753             index = deletedSlot;
   755             indexValid = false;
   754             indexValid = false;
   756 
   755 
   757             // Removal code proceeds as in closeDeletion except that
   756             // Removal code proceeds as in closeDeletion except that
   779             if (tab != IdentityHashMap.this.table) {
   778             if (tab != IdentityHashMap.this.table) {
   780                 IdentityHashMap.this.remove(key);
   779                 IdentityHashMap.this.remove(key);
   781                 expectedModCount = modCount;
   780                 expectedModCount = modCount;
   782                 return;
   781                 return;
   783             }
   782             }
       
   783 
       
   784             size--;
   784 
   785 
   785             Object item;
   786             Object item;
   786             for (int i = nextKeyIndex(d, len); (item = tab[i]) != null;
   787             for (int i = nextKeyIndex(d, len); (item = tab[i]) != null;
   787                  i = nextKeyIndex(i, len)) {
   788                  i = nextKeyIndex(i, len)) {
   788                 int r = hash(item, len);
   789                 int r = hash(item, len);