예제 #1
0
        public void add(E obj)
        {
            if (expectedModCount != outInstance.modCount)
            {
                throw new ConcurrentModificationException();
            }

            try
            {
                outInstance.add(outInstance.size() - numLeft, obj);
                expectedModCount = outInstance.modCount;
                lastPosition     = -1;
            }
            catch (java.lang.IndexOutOfBoundsException)
            {
                throw new NoSuchElementException();
            }
        }
예제 #2
0
        public virtual E next()
        {
            if (expectedModCount != outerInstance.modCount)
            {
                throw new ConcurrentModificationException();
            }

            try
            {
                int index  = outerInstance.size() - numLeft;
                E   result = outerInstance.get(index);
                lastPosition = index;
                numLeft--;
                return(result);
            }
            catch (java.lang.IndexOutOfBoundsException)
            {
                throw new NoSuchElementException();
            }
        }
예제 #3
0
 public SimpleListIterator(AbstractList <E> outerInstance)
 {
     this.outerInstance = outerInstance;
     numLeft            = outerInstance.size();
     expectedModCount   = outerInstance.modCount;
 }