Code example for AbstractMap.SimpleEntry

0
 
        //test insert 
        tree.put(11, "aa11");
        tree.put(12, "aa12");
        assertTrue(ins.contains(new SimpleEntry(11, "aa11")));
        assertTrue(ins.contains(new SimpleEntry(12, "aa12")));
        assertTrue(ins.size() == 2);
        ins.clear();
        assertTrue(dels.isEmpty());
        assertTrue(updNew.isEmpty());
        assertTrue(updOld.isEmpty());
 
        //test update 
        tree.put(12, "aa123");
        assertTrue(ins.isEmpty());
        assertTrue(dels.isEmpty());
        assertTrue(updOld.contains(new SimpleEntry(12, "aa12")));
        assertTrue(updOld.size() == 1);
        updOld.clear();
        assertTrue(updNew.contains(new SimpleEntry(12, "aa123")));