コード例 #1
0
            public void Remove()
            {
                if (lastPosition == -1)
                {
                    throw new IllegalStateException();
                }
                if (expectedModCount != parent.modCount)
                {
                    throw new ConcurrentModificationException();
                }

                try
                {
                    if (lastPosition == parent.Size() - numLeft)
                    {
                        numLeft--; // we're removing after a call to previous()
                    }
                    parent.Remove(lastPosition);
                }
                catch (IndexOutOfRangeException)
                {
                    throw new ConcurrentModificationException();
                }

                expectedModCount = parent.modCount;
                lastPosition     = -1;
            }
コード例 #2
0
 public override E Remove(int location)
 {
     if (modCount == fullList.modCount)
     {
         if (0 <= location && location < size)
         {
             E result = fullList.Remove(location + offset);
             size--;
             modCount = fullList.modCount;
             return(result);
         }
         throw new IndexOutOfRangeException();
     }
     throw new ConcurrentModificationException();
 }