/[classpath]/classpath/java/util/IdentityHashMap.java
ViewVC logotype

Diff of /classpath/java/util/IdentityHashMap.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by ericb, Fri Oct 19 07:06:45 2001 UTC revision 1.8 by ericb, Thu Oct 25 07:34:19 2001 UTC
# Line 501  public class IdentityHashMap extends Abs Line 501  public class IdentityHashMap extends Abs
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;
# Line 538  public class IdentityHashMap extends Abs Line 538  public class IdentityHashMap extends Abs
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;
# Line 600  public class IdentityHashMap extends Abs Line 600  public class IdentityHashMap extends Abs
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;
# Line 736  public class IdentityHashMap extends Abs Line 736  public class IdentityHashMap extends Abs
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    
# Line 882  public class IdentityHashMap extends Abs Line 882  public class IdentityHashMap extends Abs
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.
# Line 901  public class IdentityHashMap extends Abs Line 903  public class IdentityHashMap extends Abs
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        {        {

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26