Code example for AbstractMap.SimpleEntry

Methods: getKey, getValue, hashCode

0
        Entry ent = new AbstractMap.SimpleImmutableEntry<Integer, String>(1,"test");
        assertEquals(entry,ent);
    } 
     
    public void test_SimpleEntry_hashCode() throws Exception { 
        Entry e = new AbstractMap.SimpleEntry<Integer, String>(1, "test");
        assertEquals((e.getKey() == null ? 0 : e.getKey().hashCode())
                ^ (e.getValue() == null ? 0 : e.getValue().hashCode()), e
                .hashCode());
    } 
     
    public void test_SimpleEntry_toString() throws Exception { 
        Entry e = new AbstractMap.SimpleEntry<Integer, String>(1, "test");
        assertEquals(e.getKey()+"="+e.getValue(),e.toString());
    } 
     
    /** 
     * @tests serialization/deserialization. 
     */ 
    @SuppressWarnings({ "unchecked", "boxing" }) 
    public void testSerializationSelf_SimpleEntry() throws Exception {