home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / util / AbstractList$Itr.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.3 KB  |  64 lines

  1. package java.util;
  2.  
  3. class AbstractList$Itr implements Iterator {
  4.    int cursor;
  5.    int lastRet;
  6.    int expectedModCount;
  7.    // $FF: synthetic field
  8.    private final AbstractList this$0;
  9.  
  10.    private AbstractList$Itr(AbstractList var1) {
  11.       this.this$0 = var1;
  12.       this.cursor = 0;
  13.       this.lastRet = -1;
  14.       this.expectedModCount = this.this$0.modCount;
  15.    }
  16.  
  17.    public boolean hasNext() {
  18.       return this.cursor != this.this$0.size();
  19.    }
  20.  
  21.    public Object next() {
  22.       try {
  23.          Object var1 = this.this$0.get(this.cursor);
  24.          this.checkForComodification();
  25.          this.lastRet = this.cursor++;
  26.          return var1;
  27.       } catch (IndexOutOfBoundsException var2) {
  28.          this.checkForComodification();
  29.          throw new NoSuchElementException();
  30.       }
  31.    }
  32.  
  33.    public void remove() {
  34.       if (this.lastRet == -1) {
  35.          throw new IllegalStateException();
  36.       } else {
  37.          this.checkForComodification();
  38.  
  39.          try {
  40.             this.this$0.remove(this.lastRet);
  41.             if (this.lastRet < this.cursor) {
  42.                --this.cursor;
  43.             }
  44.  
  45.             this.lastRet = -1;
  46.             this.expectedModCount = this.this$0.modCount;
  47.          } catch (IndexOutOfBoundsException var2) {
  48.             throw new ConcurrentModificationException();
  49.          }
  50.       }
  51.    }
  52.  
  53.    final void checkForComodification() {
  54.       if (this.this$0.modCount != this.expectedModCount) {
  55.          throw new ConcurrentModificationException();
  56.       }
  57.    }
  58.  
  59.    // $FF: synthetic method
  60.    AbstractList$Itr(AbstractList var1, AbstractList.1 var2) {
  61.       this(var1);
  62.    }
  63. }
  64.