You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Leo Li (JIRA)" <ji...@apache.org> on 2007/09/06 07:30:32 UTC

[jira] Assigned: (HARMONY-4750) [classlib][luni] HashMap.HashMapEntrySet.contains(Object) cannot find custmized entry without override the equal method

     [ https://issues.apache.org/jira/browse/HARMONY-4750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leo Li reassigned HARMONY-4750:
-------------------------------

    Assignee: Leo Li

> [classlib][luni] HashMap.HashMapEntrySet.contains(Object) cannot find custmized entry without override the equal method
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4750
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4750
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Sean Qiu
>            Assignee: Leo Li
>         Attachments: Harmony-4750.diff
>
>
> Description:
> HashMap.HashMapEntrySet.contains(Object) cannot find custmized entry if the entry hasn't  override the equal method.
> Testcase:
>     @SuppressWarnings("unchecked")
>     public void test_EntrySet(){
>         HashMap map = new HashMap();
>         map.put(new Integer(1), "ONE");
>         
>         Set entrySet = map.entrySet();
>         Iterator e = entrySet.iterator();
>         Object a = e.next();
>         assertFalse(e.hasNext());
>         
>         Map.Entry entry = new MockEntry();
>         assertTrue(entrySet.contains(entry));
>         entrySet.remove(entry);
>         assertFalse(entrySet.contains(entry));
>     }
>     
>     private static class MockEntry implements Map.Entry{
>         public Object getKey() {
>             return new Integer(1);
>         }
>         public Object getValue() {
>             return "ONE";
>         }
>         public Object setValue(Object object) {
>             return null;
>         }
>     }
> Result:
> RI can pass this test while harmony will fail.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.