< prev index next >
test/jdk/java/util/concurrent/ConcurrentMap/ConcurrentModification.java
Print this page
@@ -87,10 +87,25 @@
e.setValue(4);
check(m.get(1) == 4);
}
}
} catch (Throwable t) {unexpected(t);}
+
+ try {
+ if (m instanceof ConcurrentSkipListMap) {
+ m.clear();
+ check(m.isEmpty());
+ m.put(1,2);
+ check(m.size() == 1);
+ ConcurrentSkipListMap mc = ((ConcurrentSkipListMap) m).clone();
+ check(m.size() == 1);
+ check(mc.size() == 1);
+ m.put(2,3);
+ check(m.size() == 2);
+ check(mc.size() == 1);
+ }
+ } catch (Throwable t) {unexpected(t);}
}
public static void main(String[] args) {
test(new ConcurrentHashMap<Integer,Integer>());
test(new ConcurrentSkipListMap<Integer,Integer>());
< prev index next >