Java Code Examples for java.util.ConcurrentModificationException

The following are top voted examples for showing how to use java.util.ConcurrentModificationException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: NotifyTools   File: WeakFastHashMap.java   Source Code and License 6 votes vote down vote up
public void remove() {
    if (lastReturned == null) {
        throw new IllegalStateException();
    }
    if (fast) {
        synchronized (WeakFastHashMap.this) {
            if (expected != map) {
                throw new ConcurrentModificationException();
            }
            WeakFastHashMap.this.remove(lastReturned.getKey());
            lastReturned = null;
            expected = map;
        }
    } else {
        iterator.remove();
        lastReturned = null;
    }
}
 
Example 2
Project: android-retrostreams   File: LinkedListSpliterator.java   Source Code and License 6 votes vote down vote up
@Override
public void forEachRemaining(Consumer<? super T> action) {
    Objects.requireNonNull(action);
    Object eol = endOfList;
    Object p;
    int n;
    if ((n = getEst()) > 0 && (p = current) != eol) {
        current = eol;
        est = 0;
        do {
            T item = getNodeItem(p);
            p = getNextNode(p);
            action.accept(item);
        } while (p != eol && --n > 0);
    }
    if (expectedModCount != getModCount(list)) {
        throw new ConcurrentModificationException();
    }
}
 
Example 3
Project: java-course   File: SimpleHashtable.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the next element in the iteration.
 * @return The next element in the iteration.
 * @throws ConcurrentModificationException If collection is updated while iterating through.
 * @throws NoSuchElementException If the iteration has no more elements.
 */
@Override
public TableEntry next() {
	if(expModificationCount != modificationCount) {
		throw new ConcurrentModificationException("Collection is updated while iterating through!");
	}
	for(; currentIndex < table.length; currentIndex++) {
		if(table[currentIndex] != null) {
			if(current == null) {
				current = lastReturned = table[currentIndex];
				current = current.next;
			} else {
				lastReturned = current;
				current = current.next;
			}
			if(current == null) {
				currentIndex++;
			}
			count++;
			return lastReturned;
		}
	}
	throw new NoSuchElementException("There is no more elements in collection!");
}
 
Example 4
Project: unitimes   File: AbstractSolver.java   Source Code and License 6 votes vote down vote up
@Override
public Map<String,String> statusSolutionInfo() {
	if (isPassivated())
		return (iBestSolutionInfoBeforePassivation == null ? iCurrentSolutionInfoBeforePassivation : iBestSolutionInfoBeforePassivation);
    Lock lock = currentSolution().getLock().readLock();
    lock.lock();
    try {
		Map<String,String> info = super.currentSolution().getBestInfo();
		try {
			Solution<V, T> solution = getWorkingSolution();
			if (info == null || getSolutionComparator().isBetterThanBestSolution(solution))
				info = solution.getModel().getInfo(solution.getAssignment());
		} catch (ConcurrentModificationException e) {}
		return info;
    } finally {
    	lock.unlock();
	}
}
 
Example 5
Project: Uranium   File: UnsafeList.java   Source Code and License 6 votes vote down vote up
public void remove() {
    if (lastRet < 0) {
        throw new IllegalStateException();
    }

    if (modCount != expectedModCount) {
        throw new ConcurrentModificationException();
    }

    try {
        UnsafeList.this.remove(lastRet);
        index = lastRet;
        lastRet = -1;
        expectedModCount = modCount;
    } catch (IndexOutOfBoundsException ex) {
        throw new ConcurrentModificationException();
    }
}
 
Example 6
Project: jdk8u-jdk   File: CopyOnWriteArrayList.java   Source Code and License 6 votes vote down vote up
public void replaceAll(UnaryOperator<E> operator) {
    if (operator == null) throw new NullPointerException();
    final ReentrantLock lock = l.lock;
    lock.lock();
    try {
        int lo = offset;
        int hi = offset + size;
        Object[] elements = expectedArray;
        if (l.getArray() != elements)
            throw new ConcurrentModificationException();
        int len = elements.length;
        if (lo < 0 || hi > len)
            throw new IndexOutOfBoundsException();
        Object[] newElements = Arrays.copyOf(elements, len);
        for (int i = lo; i < hi; ++i) {
            @SuppressWarnings("unchecked") E e = (E) elements[i];
            newElements[i] = operator.apply(e);
        }
        l.setArray(expectedArray = newElements);
    } finally {
        lock.unlock();
    }
}
 
Example 7
Project: Uranium   File: LongHashSet.java   Source Code and License 6 votes vote down vote up
@Override
public Long next() {
    if (modCount != expectedModCount) {
        throw new ConcurrentModificationException();
    }

    int length = values.length;
    if (index >= length) {
        lastReturned = -2;
        throw new NoSuchElementException();
    }

    lastReturned = index;
    for (index += 1; index < length && (values[index] == FREE || values[index] == REMOVED); index++) {
        // This is just to drive the index forward to the next valid entry
    }

    if (values[lastReturned] == FREE) {
        return FREE;
    } else {
        return values[lastReturned];
    }
}
 
Example 8
Project: sstore-soft   File: LocalInitQueueCallback.java   Source Code and License 6 votes vote down vote up
@Override
public String toString() {
    String ret = super.toString();
    if (this.responses.isEmpty() == false) {
        ret += "\n-------------\n";
        String debug = "";
        while (true) {
            try {
                debug = StringUtil.join("\n", this.responses); 
            } catch (ConcurrentModificationException ex) {
                continue;
            }
            break;
        }
        ret += debug;
    }
    return (ret);
}
 
Example 9
Project: alfresco-repository   File: AuthorityBridgeTableAsynchronouslyRefreshedCache.java   Source Code and License 6 votes vote down vote up
private BridgeTable<String> doBuildCache(String tenantId)
{
    List<AuthorityBridgeLink> links = authorityBridgeDAO.getAuthorityBridgeLinks();
    BridgeTable<String> bridgeTable = new BridgeTable<String>();
    try
    {
        for (AuthorityBridgeLink link : links)
        {
            bridgeTable.addLink(link.getParentName(), link.getChildName());
        }
    }
    catch (ConcurrentModificationException e)
    {
        // Explain exception
        checkCyclic(links);
        // If cyclic groups is not the cause then rethrow
        throw e;
    }
    return bridgeTable;
}
 
Example 10
Project: hadoop-oss   File: LightWeightGSet.java   Source Code and License 6 votes vote down vote up
private void ensureNext() {
  if (trackModification && modification != iterModification) {
    throw new ConcurrentModificationException("modification=" + modification
        + " != iterModification = " + iterModification);
  }
  if (next != null) {
    return;
  }
  if (cur == null) {
    return;
  }
  next = cur.getNext();
  if (next == null) {
    next = nextNonemptyEntry();
  }
}
 
Example 11
Project: xcc   File: THashPrimitiveIterator.java   Source Code and License 6 votes vote down vote up
/**
 * Removes the last entry returned by the iterator.
 * Invoking this method more than once for a single entry
 * will leave the underlying data structure in a confused
 * state.
 */
public void remove() {
    if (_expectedSize != _hash.size()) {
        throw new ConcurrentModificationException();
    }

    // Disable auto compaction during the remove. This is a workaround for bug 1642768.
    try {
        _hash.tempDisableAutoCompaction();
        _hash.removeAt(_index);
    }
    finally {
        _hash.reenableAutoCompaction( false );
    }

    _expectedSize--;
}
 
Example 12
Project: hadoop   File: LightWeightHashSet.java   Source Code and License 5 votes vote down vote up
@Override
public T next() {
  if (modification != startModification) {
    throw new ConcurrentModificationException("modification="
        + modification + " != startModification = " + startModification);
  }
  if (next == null) {
    throw new NoSuchElementException();
  }
  final T e = next.element;
  // find the next element
  final LinkedElement<T> n = next.next;
  next = n != null ? n : nextNonemptyEntry();
  return e;
}
 
Example 13
Project: guava-mock   File: MapPutTester.java   Source Code and License 5 votes vote down vote up
@MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT})
@CollectionSize.Require(absent = ZERO)
public void testPutAbsentConcurrentWithValueIteration() {
  try {
    Iterator<V> iterator = getMap().values().iterator();
    put(e3());
    iterator.next();
    fail("Expected ConcurrentModificationException");
  } catch (ConcurrentModificationException expected) {
    // success
  }
}
 
Example 14
Project: OpenJSharp   File: CopyOnWriteArrayList.java   Source Code and License 5 votes vote down vote up
public boolean retainAll(Collection<?> c) {
    if (c == null) throw new NullPointerException();
    boolean removed = false;
    final ReentrantLock lock = l.lock;
    lock.lock();
    try {
        int n = size;
        if (n > 0) {
            int lo = offset;
            int hi = offset + n;
            Object[] elements = expectedArray;
            if (l.getArray() != elements)
                throw new ConcurrentModificationException();
            int len = elements.length;
            if (lo < 0 || hi > len)
                throw new IndexOutOfBoundsException();
            int newSize = 0;
            Object[] temp = new Object[n];
            for (int i = lo; i < hi; ++i) {
                Object element = elements[i];
                if (c.contains(element))
                    temp[newSize++] = element;
            }
            if (newSize != n) {
                Object[] newElements = new Object[len - n + newSize];
                System.arraycopy(elements, 0, newElements, 0, lo);
                System.arraycopy(temp, 0, newElements, lo, newSize);
                System.arraycopy(elements, hi, newElements,
                                 lo + newSize, len - hi);
                size = newSize;
                removed = true;
                l.setArray(expectedArray = newElements);
            }
        }
    } finally {
        lock.unlock();
    }
    return removed;
}
 
Example 15
Project: cuttlefish   File: ContestSimulation.java   Source Code and License 5 votes vote down vote up
public void reset() {
	setIncremental(true);
	for (Edge edge : super.getEdges())
		super.removeEdge(edge);

	Collection<Vertex> vertices = super.getVertices();
	while (!vertices.isEmpty()) {
		try {
			for (Vertex vertex : vertices)
				super.removeVertex(vertex);
		} catch (ConcurrentModificationException e) {
		}
	}
	update(0);
}
 
Example 16
Project: guava-mock   File: MapPutTester.java   Source Code and License 5 votes vote down vote up
@MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT})
@CollectionSize.Require(absent = ZERO)
public void testPutAbsentConcurrentWithEntrySetIteration() {
  try {
    Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
    put(e3());
    iterator.next();
    fail("Expected ConcurrentModificationException");
  } catch (ConcurrentModificationException expected) {
    // success
  }
}
 
Example 17
Project: APCSAB   File: MyStack.java   Source Code and License 5 votes vote down vote up
public E next() {
    // Load head lazily
    if (-1 == size) {
        size = MyStack.this.size;
        next = head;
    }
    // Size has changed
    if (size != MyStack.this.size)
        throw new ConcurrentModificationException();
    E value = next.value;
    next = next.getNext();
    return value;
}
 
Example 18
Project: guava-mock   File: MapClearTester.java   Source Code and License 5 votes vote down vote up
@MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
@CollectionSize.Require(SEVERAL)
public void testClearConcurrentWithEntrySetIteration() {
  try {
    Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
    getMap().clear();
    iterator.next();
    fail("Expected ConcurrentModificationException");
  } catch (ConcurrentModificationException expected) {
    // success
  }
}
 
Example 19
Project: s-store   File: AbstractMapBasedMultimap.java   Source Code and License 5 votes vote down vote up
/**
 * If the delegate collection is empty, but the multimap has values for the
 * key, replace the delegate with the new collection for the key.
 *
 * <p>For a subcollection, refresh its ancestor and validate that the
 * ancestor delegate hasn't changed.
 */
void refreshIfEmpty() {
  if (ancestor != null) {
    ancestor.refreshIfEmpty();
    if (ancestor.getDelegate() != ancestorDelegate) {
      throw new ConcurrentModificationException();
    }
  } else if (delegate.isEmpty()) {
    Collection<V> newDelegate = map.get(key);
    if (newDelegate != null) {
      delegate = newDelegate;
    }
  }
}
 
Example 20
Project: openjdk-jdk10   File: SubList.java   Source Code and License 5 votes vote down vote up
@Test(dataProvider = "modifiable",
      expectedExceptions = ConcurrentModificationException.class)
public void testModIteratorRemove(List<Integer> list, int from, int to) {
    List<Integer> subList = list.subList(from, to);
    Iterator<Integer> it = subList.iterator();
    it.next();
    list.add(42);
    it.remove();
}
 
Example 21
Project: java-course   File: SimpleHashtableTest.java   Source Code and License 5 votes vote down vote up
@Test(expected=ConcurrentModificationException.class)
public void iteratorThrowExceptionIfPuttingAndRemovingElement() {
	fillHashtable();
	
	Iterator<SimpleHashtable.TableEntry> iterator = hashtable.iterator();
	while(iterator.hasNext()) {
		SimpleHashtable.TableEntry pair = iterator.next();
		if(pair.getValue().equals("Njemacka")) {
			hashtable.put("Toyota","Japan");
			iterator.remove();
		}
	}
}
 
Example 22
Project: GitHub   File: StatefulRunnableTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testClosesResultWhenOnSuccessThrows() throws Exception {
  doThrow(mException).when(mStatefulRunnable).onSuccess(mResult);
  try {
    runSuccess();
    fail();
  } catch (ConcurrentModificationException cme) {
    // expected
  }
  verify(mStatefulRunnable).disposeResult(mResult);
}
 
Example 23
Project: GitHub   File: ArtDecoderTest.java   Source Code and License 5 votes vote down vote up
@Test(expected = ConcurrentModificationException.class)
public void testBitmapFactoryThrowsAnException() {
  whenBitmapFactoryDecodeStream()
      .thenAnswer(mBitmapFactoryDefaultAnswer)
      .thenThrow(new ConcurrentModificationException());
  try {
    mArtDecoder.decodeFromEncodedImage(mEncodedImage, DEFAULT_BITMAP_CONFIG, null);
  } finally {
    verify(mBitmapPool).release(mBitmap);
  }
}
 
Example 24
Project: dremio-oss   File: DatastoreRpcClient.java   Source Code and License 5 votes vote down vote up
public void delete(String storeId, ByteString key, long previousVersion) throws RpcException {
  final DeleteRequest.Builder builder = DeleteRequest.newBuilder();
  builder.setStoreId(storeId);
  builder.setKey(key);
  builder.setPreviousVersion(previousVersion);
  ReceivedResponseMessage<DeleteResponse> response = rpcService.getDeleteEndpoint().send(builder.build());
  if (response.getBody().hasConcurrentModificationError()) {
    throw new ConcurrentModificationException(response.getBody().getConcurrentModificationError());
  }
}
 
Example 25
Project: googles-monorepo-demo   File: AbstractMultisetSetCountTester.java   Source Code and License 5 votes vote down vote up
@CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
@CollectionSize.Require(absent = ZERO)
public void testSetCountOneToZeroConcurrentWithEntrySetIteration() {
  try {
    Iterator<Entry<E>> iterator = getMultiset().entrySet().iterator();
    assertSetCount(e0(), 0);
    iterator.next();
    fail("Expected ConcurrentModificationException");
  } catch (ConcurrentModificationException expected) {
    // success
  }
}
 
Example 26
Project: monarch   File: ObjectIntHashMap.java   Source Code and License 5 votes vote down vote up
final Entry nextEntry() {
  if (modCount != expectedModCount)
    throw new ConcurrentModificationException();
  Entry e = next;
  if (e == null)
    throw new NoSuchElementException();

  if ((next = e.next) == null) {
    Entry[] t = table;
    while (index < t.length && (next = t[index++]) == null);
  }
  current = e;
  return e;
}
 
Example 27
Project: guava-mock   File: CollectionRemoveIfTester.java   Source Code and License 5 votes vote down vote up
@CollectionFeature.Require({SUPPORTS_ITERATOR_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
@CollectionSize.Require(SEVERAL)
public void testRemoveIfSomeMatchesConcurrentWithIteration() {
  try {
    Iterator<E> iterator = collection.iterator();
    assertTrue(collection.removeIf(Predicate.isEqual(samples.e0())));
    iterator.next();
    fail("Expected ConcurrentModificationException");
  } catch (ConcurrentModificationException expected) {
    // success
  }
}
 
Example 28
Project: guava-mock   File: CollectionRemoveAllTester.java   Source Code and License 5 votes vote down vote up
@CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
@CollectionSize.Require(SEVERAL)
public void testRemoveAllSomePresentConcurrentWithIteration() {
  try {
    Iterator<E> iterator = collection.iterator();
    assertTrue(collection.removeAll(MinimalCollection.of(e0(), e3())));
    iterator.next();
    fail("Expected ConcurrentModificationException");
  } catch (ConcurrentModificationException expected) {
    // success
  }
}
 
Example 29
Project: HCFCore   File: AbstractLinkedMap.java   Source Code and License 5 votes vote down vote up
protected LinkEntry<K, V> nextEntry() {
    if (parent.modCount != expectedModCount) {
        throw new ConcurrentModificationException();
    }
    if (next == parent.header)  {
        throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
    }
    last = next;
    next = next.after;
    return last;
}
 
Example 30
Project: HCFCore   File: AbstractLinkedMap.java   Source Code and License 5 votes vote down vote up
protected LinkEntry<K, V> nextEntry() {
    if (parent.modCount != expectedModCount) {
        throw new ConcurrentModificationException();
    }
    if (next == parent.header)  {
        throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
    }
    last = next;
    next = next.after;
    return last;
}
 
Example 31
Project: java-kdtree   File: TreeMapTest.java   Source Code and License 5 votes vote down vote up
@Test(expected = ConcurrentModificationException.class)
public void testConcurrentRemoveAll() throws Exception {
	ArrayList<CartesianPoint> list = new ArrayList<>();
	TreeMap<CartesianPoint, String> map = new TreeMap<>(TreeMap.Space2D);
	for (int i = 0; i < 10; i++) {
		CartesianPoint point = new CartesianPoint(i, i);
		map.put(point, Integer.toString(i * i));
		if (i % 2 == 0) list.add(point.clone());
	}
	Iterator<Entry<CartesianPoint, String>> iterator = map.entrySet().iterator();
	map.keySet().removeAll(list);
	iterator.next();
}
 
Example 32
Project: HCFCore   File: AbstractPatriciaTrie.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the next {@link TrieEntry}.
 */
protected TrieEntry<K,V> nextEntry() {
    if (expectedModCount != AbstractPatriciaTrie.this.modCount) {
        throw new ConcurrentModificationException();
    }

    final TrieEntry<K,V> e = next;
    if (e == null) {
        throw new NoSuchElementException();
    }

    next = findNext(e);
    current = e;
    return e;
}
 
Example 33
Project: Logisim   File: ArraySet.java   Source Code and License 5 votes vote down vote up
@Override
public E next() {
	if (itVersion != version) {
		throw new ConcurrentModificationException();
	} else if (!hasNext) {
		throw new NoSuchElementException();
	} else {
		E ret = (E) values[pos];
		++pos;
		hasNext = pos < values.length;
		removeOk = true;
		return ret;
	}
}
 
Example 34
Project: java-kdtree   File: TreeMapTest.java   Source Code and License 5 votes vote down vote up
@Test(expected = ConcurrentModificationException.class)
public void testConcurrentRemoveKeyValue() throws Exception {
	TreeMap<CartesianPoint, String> map = new TreeMap<>(TreeMap.Space2D);
	for (int i = 0; i < 10; i++) {
		CartesianPoint point = new CartesianPoint(i, i);
		map.put(point, Integer.toString(i * i));
	}
	Iterator<Entry<CartesianPoint, String>> iterator = map.entrySet().iterator();
	map.remove(new CartesianPoint(0, 0), Integer.toString(0));
	iterator.next();
}
 
Example 35
Project: dremio-oss   File: DatastoreRpcClient.java   Source Code and License 5 votes vote down vote up
public Long put(String storeId, ByteString key, ByteString value) throws RpcException {
  final PutRequest.Builder builder = PutRequest.newBuilder();
  builder.setStoreId(storeId);
  builder.setKey(key);
  builder.setValue(value);
  ReceivedResponseMessage<PutResponse> response = rpcService.getPutEndpoint().send(builder.build());
  if (response.getBody().hasConcurrentModificationError()) {
    throw new ConcurrentModificationException(response.getBody().getConcurrentModificationError());
  }
  if (response.getBody().hasVersion()) {
    return response.getBody().getVersion();
  }
  return null;
}
 
Example 36
Project: googles-monorepo-demo   File: CollectionAddTester.java   Source Code and License 5 votes vote down vote up
@CollectionFeature.Require({SUPPORTS_ADD, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
@CollectionSize.Require(absent = ZERO)
public void testAddConcurrentWithIteration() {
  try {
    Iterator<E> iterator = collection.iterator();
    assertTrue(collection.add(e3()));
    iterator.next();
    fail("Expected ConcurrentModificationException");
  } catch (ConcurrentModificationException expected) {
    // success
  }
}
 
Example 37
Project: incubator-netbeans   File: JavaElementFoldVisitor.java   Source Code and License 5 votes vote down vote up
private void handleJavadoc(Tree t) throws BadLocationException, ConcurrentModificationException {
    int start = (int) sp.getStartPosition(cu, t);

    if (start == (-1))
        return ;

    if (start < initialCommentStopPos)
        initialCommentStopPos = start;

    TokenHierarchy<?> th = info.getTokenHierarchy();
    TokenSequence<JavaTokenId>  ts = th.tokenSequence(JavaTokenId.language());

    if (ts.move(start) == Integer.MAX_VALUE) {
        return;//nothing
    }

    while (ts.movePrevious()) {
        Token<JavaTokenId> token = ts.token();

        if (token.id() == JavaTokenId.JAVADOC_COMMENT) {
            int startOffset = ts.offset();
            addFold(creator.createJavadocFold(startOffset, startOffset + token.length()), startOffset);
            if (startOffset < initialCommentStopPos)
                initialCommentStopPos = startOffset;
        }
        if (   token.id() != JavaTokenId.WHITESPACE
            && token.id() != JavaTokenId.BLOCK_COMMENT
            && token.id() != JavaTokenId.LINE_COMMENT)
            break;
    }
}
 
Example 38
Project: incubator-netbeans   File: TimeComponentPanel.java   Source Code and License 5 votes vote down vote up
private void fillTimeTable() {
    Reference ref = (Reference)jList1.getSelectedValue();
    Object fo = ref == null ? null : ref.get();
    
    // clear the table
    DefaultTableModel model = (DefaultTableModel) times.getModel();
    while (model.getRowCount() > 0) {
        model.removeRow(0);
    }
    key2RowNumber.clear();
    
    if (fo == null) return;
    
    Collection<String> keys = TimesCollectorPeer.getDefault().getKeysForFile(fo);
    for (int i = 0; i < 10; i++) {
        try {
            synchronized(keys) {
                for (String key : keys) {
                    changeRow(fo, key);
                }
                return;
            }
        } catch (ConcurrentModificationException ex) {
            LOG.log(Level.INFO, "Retry " + i, ex);
        }
    }
}
 
Example 39
Project: incubator-netbeans   File: IdentityHashSet.java   Source Code and License 5 votes vote down vote up
protected int nextIndex() {
    if (modCount != expectedModCount) {
        throw new ConcurrentModificationException();
    }
    if (!hasNext()) {
        throw new NoSuchElementException();
    }

    indexValid = false;
    lastReturnedIndex = index;
    index++;
    return lastReturnedIndex;
}
 
Example 40
Project: guava-mock   File: AbstractMultisetSetCountTester.java   Source Code and License 5 votes vote down vote up
@CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
@CollectionSize.Require(absent = ZERO)
public void testSetCountOneToZeroConcurrentWithEntrySetIteration() {
  try {
    Iterator<Entry<E>> iterator = getMultiset().entrySet().iterator();
    assertSetCount(e0(), 0);
    iterator.next();
    fail("Expected ConcurrentModificationException");
  } catch (ConcurrentModificationException expected) {
    // success
  }
}