test/jdk/java/util/LinkedHashMap/EmptyMapIterator.java
changeset 48541 946e34c2dec9
parent 47730 c7b5b1ce8145
equal deleted inserted replaced
48540:221cf8307606 48541:946e34c2dec9
    25  * @test
    25  * @test
    26  * @bug 4473440
    26  * @bug 4473440
    27  * @summary iterators on collection views of empty map weren't fail-fast.
    27  * @summary iterators on collection views of empty map weren't fail-fast.
    28  */
    28  */
    29 
    29 
    30 import java.util.*;
    30 import java.util.ConcurrentModificationException;
       
    31 import java.util.HashMap;
       
    32 import java.util.Iterator;
    31 
    33 
    32 public class EmptyMapIterator {
    34 public class EmptyMapIterator {
    33     public static void main(String[] args) throws Exception {
    35     public static void main(String[] args) throws Exception {
    34         HashMap map = new HashMap();
    36         HashMap map = new HashMap();
    35         Iterator iter = iter = map.entrySet().iterator();
    37         Iterator iter = map.entrySet().iterator();
    36         map.put("key", "value");
    38         map.put("key", "value");
    37 
    39 
    38         try {
    40         try {
    39             iter.next();
    41             iter.next();
    40             throw new Exception("No exception thrown");
    42             throw new Exception("No exception thrown");