MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

collectiontopics/FailFast.java:9–18  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

7
8public class FailFast {
9 public static void main(String[] args) {
10 Collection<String> c = new ArrayList<>();
11 Iterator<String> it = c.iterator();
12 c.add("An object");
13 try {
14 String s = it.next();
15 } catch(ConcurrentModificationException e) {
16 System.out.println(e);
17 }
18 }
19}
20/* Output:
21java.util.ConcurrentModificationException

Callers

nothing calls this directly

Calls 3

nextMethod · 0.65
iteratorMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected