April 2019
Intermediate to advanced
360 pages
9h 17m
English
Let's take a look at an example. The FailFastImplementation1 class code is provided next in two sections. This class demonstrates the use of Iterator to catch an exception. The first section of our code consists of the import statements and the start of the main() method. The main() method starts by printing a blank line and then creates a HashMap of first and last names. Four key-value pairs are added using the put() method:
package CH9FailFast;import java.util.ConcurrentModificationException;import java.util.HashMap;import java.util.Iterator;import java.util.Map;public class FailFastImplementation1 { public static void main(String[] args) throws ConcurrentModificationException { System.out.println(); Map<String, ...
Read now
Unlock full access