Code example for AbstractMap.SimpleEntry

Methods: getValue, setValue

0
        entry = new AbstractMap.SimpleEntry(null,null);
        assertNull(entry.getValue());
    } 
     
    public void test_SimpleEntry_setValue() throws Exception { 
        Entry entry = new AbstractMap.SimpleEntry<Integer, String>(1,"test");
        assertEquals("test",entry.getValue());
        entry.setValue("Another String");
        assertEquals("Another String",entry.getValue());
        entry = new AbstractMap.SimpleEntry(null,null);
        assertNull(entry.getKey());
    } 
     
    public void test_SimpleEntry_equals() throws Exception { 
        Entry entry = new AbstractMap.SimpleEntry<Integer, String>(1,"test");
        Map map = new TreeMap();
        map.put(1, "test");
        Entry entryToPut = (Entry)map.entrySet().iterator().next();
        Entry testEntry = new AbstractMap.SimpleEntry(entryToPut);
        assertEquals(entry,testEntry);
Connect your IDE to all the code out there  Get Codota for Java