Package java.util

Examples of java.util.ConcurrentModificationException


            @Override public E next () {
                checkForComodification();
                int ii = _cursor;
                if (ii >= _size) throw new NoSuchElementException();
                Object[] data = _data;
                if (ii >= data.length) throw new ConcurrentModificationException();
                _cursor = ii + 1;
                @SuppressWarnings("unchecked") E elem = (E) data[_lastRet = ii];
                return elem;
            }

            @Override public void remove () {
                if (_lastRet < 0) throw new IllegalStateException();
                checkForComodification();
                try {
                    DestroyableList.this.remove(_lastRet);
                    _cursor = _lastRet;
                    _lastRet = -1;
                    _exModCount = _modCount;
                } catch (IndexOutOfBoundsException ex) {
                    throw new ConcurrentModificationException();
                }
            }

            final void checkForComodification() {
                if (_modCount != _exModCount) throw new ConcurrentModificationException();
            }

            protected int _cursor;       // index of next element to return
            protected int _lastRet = -1; // index of last element returned; -1 if no such
            protected int _exModCount = _modCount;
View Full Code Here


                int index=0;

                @Override
                public boolean hasNext() {
                    if(size() != startSize) {
                        throw new ConcurrentModificationException();
                    }
                    return index < values.size();
                }

                @Override
View Full Code Here

  }

  public void editBegin( AbstractCompoundEdit ce )
  {
    if( currentEdit != null ) {
      throw new ConcurrentModificationException( "Concurrent editing" );
    }
    currentEdit    = ce;
    collEditByStart  = null;    // dispose ? XXXX
    collEditByStop  = null;    // dispose ? XXXX
View Full Code Here

  {
    if( currentEdit == null ) {
      throw new IllegalStateException( "Missing editBegin" );
    }
    if( ce != currentEdit ) {
      throw new ConcurrentModificationException( "Concurrent editing" );
    }
  }
View Full Code Here

         * @exception NoSuchElementException if there is no element left in the map
         */
        public int key()
            throws ConcurrentModificationException, NoSuchElementException {
            if (referenceCount != count) {
                throw new ConcurrentModificationException();
            }
            if (current < 0) {
                throw new NoSuchElementException();
            }
            return keys[current];
View Full Code Here

         * @exception NoSuchElementException if there is no element left in the map
         */
        public T value()
            throws ConcurrentModificationException, NoSuchElementException {
            if (referenceCount != count) {
                throw new ConcurrentModificationException();
            }
            if (current < 0) {
                throw new NoSuchElementException();
            }
            return values[current];
View Full Code Here

         */
        public void advance()
            throws ConcurrentModificationException, NoSuchElementException {

            if (referenceCount != count) {
                throw new ConcurrentModificationException();
            }

            // advance on step
            current = next;

View Full Code Here

        public boolean remove(Object o) {
            synchronized (CopyOnWriteArrayList.this) {
                Object[] array = getArray();
                if (array != expectedArray)
                    throw new ConcurrentModificationException();
                int fullLength = array.length;
                int pos = search(array, o, offset, length);
                if (pos < 0) return false;
                Object[] newarr = new Object[fullLength - 1];
                int moved = length - pos - 1;
View Full Code Here

                    throw new IndexOutOfBoundsException("Index: " + index +
                        ", Size: " + length);
                }
                Object[] oldarr = getArray();
                if (oldarr != expectedArray)
                    throw new ConcurrentModificationException();
                if (added == 0) return false;
                int fullLength = oldarr.length;
                Object[] newarr = new Object[fullLength + added];
                int pos = offset + index;
                int newpos = pos;
View Full Code Here

        public boolean removeAll(Collection c) {
            if (c.isEmpty()) return false;
            synchronized (CopyOnWriteArrayList.this) {
                Object[] array = getArray();
                if (array != expectedArray)
                    throw new ConcurrentModificationException();
                int fullLength = array.length;
                Object[] tmp = new Object[length];
                int retained = 0;
                for (int i = offset; i < offset + length; i++) {
                    Object o = array[i];
View Full Code Here

TOP

Related Classes of java.util.ConcurrentModificationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.