Code example for WeakHashMap

Methods: keySetput

     * Regression test for HARMONY-3883 
     * @tests java.util.WeakHashMap#keySet() 
    public void test_keySet_hasNext() { 
        WeakHashMap map = new WeakHashMap();
        ConstantHashClass cl = new ConstantHashClass(2);
        map.put(new ConstantHashClass(1), null);
        map.put(cl, null);
        map.put(new ConstantHashClass(3), null);
        Iterator iter = map.keySet().iterator();;;
        assertFalse("Wrong hasNext() value", iter.hasNext());
    static class ConstantHashClass { 
        private int id = 0;
Connect your IDE to all the code out there  Get Codota for Java