}
break;
}
case 3: {
// write with Map.duplicates().iterator().add()
writeIterRunner.run(new TransactionWorker() {
public void doWork() throws Exception {
Collection dups = map.duplicates(key);
Iterator iter = dups.iterator();
assertEquals(values[0], iter.next());
assertTrue(!iter.hasNext());
try {
for (int j = 1; j < values.length; j += 1) {
((ListIterator) iter).add(values[j]);
}
} finally {
StoredIterator.close(iter);
}
}
});
break;
}
case 4: {
// write with Map.values().add()
if (!isEntityBinding) {
continue;
}
Collection set = map.values();
for (int j = 1; j < values.length; j += 1) {
set.add(values[j]);
}
break;
}
default: {
break outerLoop;
}
}
checkDupsSize(values.length, map.duplicates(key));
// read duplicates
readDuplicates(i, key, values);
// remove duplicates
switch (writeMode) {
case 0: {
// remove with Map.remove()
checkDupsSize(values.length, map.duplicates(key));
map.remove(key); // remove all values
checkDupsSize(0, map.duplicates(key));
map.put(key, values[0]); // put back original value
checkDupsSize(1, map.duplicates(key));
break;
}
case 1: {
// remove with Map.keySet().remove()
map.keySet().remove(key); // remove all values
map.put(key, values[0]); // put back original value
break;
}
case 2: {
// remove with Map.duplicates().clear()
dups = map.duplicates(key);
dups.clear(); // remove all values
dups.add(values[0]); // put back original value
break;
}
case 3: {
// remove with Map.duplicates().iterator().remove()
writeIterRunner.run(new TransactionWorker() {
public void doWork() throws Exception {
Collection dups = map.duplicates(key);
Iterator iter = dups.iterator();
try {
for (int j = 0; j < values.length; j += 1) {