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

Diff of /classpath/java/util/AbstractList.java

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

revision 1.15 by ericb, Fri Oct 19 00:17:44 2001 UTC revision 1.16 by ericb, Mon Oct 22 03:46:07 2001 UTC
# Line 73  public abstract class AbstractList exten Line 73  public abstract class AbstractList exten
73     * <code>add(int, Object)</code> and <code>remove(int)</code> methods.     * <code>add(int, Object)</code> and <code>remove(int)</code> methods.
74     * Otherwise, this field may be ignored.     * Otherwise, this field may be ignored.
75     */     */
76    protected int modCount = 0;    protected int modCount;
77    
78    /**    /**
79     * The main constructor, for use by subclasses.     * The main constructor, for use by subclasses.
# Line 209  public abstract class AbstractList exten Line 209  public abstract class AbstractList exten
209    {    {
210      if (o == this)      if (o == this)
211        return true;        return true;
212      if (!(o instanceof List))      if (! (o instanceof List))
213        return false;        return false;
214      int size = size();      int size = size();
215      if (size != ((List) o).size())      if (size != ((List) o).size())
# Line 323  public abstract class AbstractList exten Line 323  public abstract class AbstractList exten
323          AbstractList.this.remove(last);          AbstractList.this.remove(last);
324          pos--;          pos--;
325          size--;          size--;
         knownMod = modCount;  
326          last = -1;          last = -1;
327            knownMod = modCount;
328        }        }
329      };      };
330    }    }
# Line 446  public abstract class AbstractList exten Line 446  public abstract class AbstractList exten
446            throw new IllegalStateException();            throw new IllegalStateException();
447          AbstractList.this.remove(lastReturned);          AbstractList.this.remove(lastReturned);
448          size--;          size--;
         knownMod = modCount;  
449          position = lastReturned;          position = lastReturned;
450          lastReturned = -1;          lastReturned = -1;
451            knownMod = modCount;
452        }        }
453    
454        public void set(Object o)        public void set(Object o)
# Line 721  class SubList extends AbstractList Line 721  class SubList extends AbstractList
721      checkMod();      checkMod();
722      checkBoundsInclusive(index);      checkBoundsInclusive(index);
723      backingList.add(index + offset, o);      backingList.add(index + offset, o);
     modCount = backingList.modCount;  
724      size++;      size++;
725        modCount = backingList.modCount;
726    }    }
727    
728    /**    /**
# Line 736  class SubList extends AbstractList Line 736  class SubList extends AbstractList
736      checkMod();      checkMod();
737      checkBoundsExclusive(index);      checkBoundsExclusive(index);
738      Object o = backingList.remove(index + offset);      Object o = backingList.remove(index + offset);
     modCount = backingList.modCount;  
739      size--;      size--;
740        modCount = backingList.modCount;
741      return o;      return o;
742    }    }
743    
# Line 754  class SubList extends AbstractList Line 754  class SubList extends AbstractList
754      checkMod();      checkMod();
755    
756      backingList.removeRange(offset + fromIndex, offset + toIndex);      backingList.removeRange(offset + fromIndex, offset + toIndex);
     modCount = backingList.modCount;  
757      size -= toIndex - fromIndex;      size -= toIndex - fromIndex;
758        modCount = backingList.modCount;
759    }    }
760    
761    /**    /**
# Line 771  class SubList extends AbstractList Line 771  class SubList extends AbstractList
771      checkBoundsInclusive(index);      checkBoundsInclusive(index);
772      int csize = c.size();      int csize = c.size();
773      boolean result = backingList.addAll(offset + index, c);      boolean result = backingList.addAll(offset + index, c);
     modCount = backingList.modCount;  
774      size += csize;      size += csize;
775        modCount = backingList.modCount;
776      return result;      return result;
777    }    }
778    
# Line 855  class SubList extends AbstractList Line 855  class SubList extends AbstractList
855        public void remove()        public void remove()
856        {        {
857          i.remove();          i.remove();
         modCount = backingList.modCount;  
858          size--;          size--;
859          position = nextIndex();          position = nextIndex();
860            modCount = backingList.modCount;
861        }        }
862    
863        public void set(Object o)        public void set(Object o)
# Line 868  class SubList extends AbstractList Line 868  class SubList extends AbstractList
868        public void add(Object o)        public void add(Object o)
869        {        {
870          i.add(o);          i.add(o);
         modCount = backingList.modCount;  
871          size++;          size++;
872          position++;          position++;
873            modCount = backingList.modCount;
874        }        }
875    
876        // Here is the reason why the various modCount fields are mostly        // Here is the reason why the various modCount fields are mostly

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

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