Package java.util

Examples of java.util.ConcurrentModificationException


        public boolean retainAll(Collection c) {
            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


        public void clear() {
            synchronized (CopyOnWriteArrayList.this) {
                Object[] array = getArray();
                if (array != expectedArray)
                    throw new ConcurrentModificationException();
                int fullLength = array.length;
                Object[] newarr = new Object[fullLength - length];
                int moved = fullLength - offset - length;
                if (offset > 0) System.arraycopy(array, 0, newarr, 0, offset);
                if (moved > 0)
View Full Code Here

            Object[] array;
            int last;
            synchronized (CopyOnWriteArrayList.this) {
                array = getArray();
                if (array != expectedArray)
                    throw new ConcurrentModificationException();
                last = offset + length;
            }
            ListIterator itr = ((List) o).listIterator();
            int idx = offset;
            while (idx < last && itr.hasNext()) {
View Full Code Here

            Object[] array;
            int last;
            synchronized (CopyOnWriteArrayList.this) {
                array = getArray();
                if (array != expectedArray)
                    throw new ConcurrentModificationException();
                last = offset + length;
            }
            for (int i = offset; i < last; i++) {
                Object o = array[i];
                hashCode = 31 * hashCode + (o == null ? 0 : o.hashCode());
View Full Code Here

                    throw new IndexOutOfBoundsException("Index: " + index +
                        ", Size: " + length);
                }
                Object[] oldarr = getArray();
                if (oldarr != expectedArray)
                    throw new ConcurrentModificationException();
                int fullLength = oldarr.length;
                // piggyback the array bounds check
                Object oldVal = oldarr[offset + index];
                if (oldVal == element) {
                    setArray(oldarr);
View Full Code Here

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

                    throw new IndexOutOfBoundsException("Index: " + index +
                        ", Size: " + length);
                }
                Object[] array = getArray();
                if (array != expectedArray)
                    throw new ConcurrentModificationException();
                int fullLength = array.length;
                int pos = offset + index;
                Object result = array[pos];
                Object[] newarr = new Object[fullLength - 1];
                int moved = fullLength - pos - 1;
View Full Code Here

        public ListIterator listIterator() {
            // must synchronize to atomically obtain the array and length
            synchronized (CopyOnWriteArrayList.this) {
                Object[] array = getArray();
                if (array != expectedArray)
                    throw new ConcurrentModificationException();
                return new COWSubIterator(array, offset, offset + length,
                    offset);
            }
        }
View Full Code Here

                    throw new IndexOutOfBoundsException("Index: " + index +
                        ", Size: " + length);
                }
                Object[] array = getArray();
                if (array != expectedArray)
                    throw new ConcurrentModificationException();
                return new COWSubIterator(array, offset, offset + length,
                    offset + index);
            }
        }
View Full Code Here

            Object[] array;
            int last;
            synchronized (CopyOnWriteArrayList.this) {
                array = getArray();
                if (array != expectedArray)
                    throw new ConcurrentModificationException();
                last = offset + length;
            }
            StringBuffer buf = new StringBuffer();
            buf.append('[');
            for (int i = offset; i < last; 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.