multiMap.put("2", "x");
multiMap.put("2", "y");
final TransactionContext context = instance.newTransactionContext();
context.beginTransaction();
TransactionalMultiMap txnMap = context.getMultiMap("testMultiMapPutRemoveWithTxn");
txnMap.put("1", "A");
txnMap.put("1", "B");
Collection g1 = txnMap.get("1");
assertTrue(g1.contains("A"));
assertTrue(g1.contains("B"));
assertTrue(g1.contains("C"));
assertTrue(txnMap.remove("1", "C"));
assertEquals(4, txnMap.size());
Collection g2 = txnMap.get("1");
assertTrue(g2.contains("A"));
assertTrue(g2.contains("B"));
assertFalse(g2.contains("C"));
Collection r1 = txnMap.remove("2");
assertTrue(r1.contains("x"));
assertTrue(r1.contains("y"));
assertEquals(0, txnMap.get("2").size());
Collection r2 = txnMap.remove("1");
assertEquals(2, r2.size());
assertTrue(r2.contains("A"));
assertTrue(r2.contains("B"));
assertEquals(0, txnMap.get("1").size());
assertEquals(0, txnMap.size());
assertEquals(3, multiMap.size());
context.commitTransaction();
assertEquals(0, multiMap.size());
}