Code example for ConcurrentModificationException

0
        private int at = 0;
 
        /** {@inheritDoc} */ 
        public boolean hasMoreElements() { 
            if (size != origSize) {
                throw new ConcurrentModificationException();
            } 
 
            return at < origSize;
        } 
 
        /** {@inheritDoc} */ 
        public Object nextElement() {
            if (size != origSize) {
                throw new ConcurrentModificationException();
            } 
 
            return getKey(at++);
        } 
    } 
}