WeakHashMap doesn't remove obsolete entries
<p>How can I model the removal of entries in WeakHashMap if there are no active references to one of it keys. I have next code:</p>

<pre><code>WeakHashMap&lt;Integer, String&gt; weakMap = new WeakHashMap&lt;Integer, String&gt;();
Integer st1 = 5;
Integer st2 = 6;
String val = "BB";
weakMap.put(st1, "AA");
weakMap.put(st2, val);
st1 = 10;
//st1 = null;
//System.gc();
for (Map.Entry&lt;Integer, String&gt; entry : map.entrySet()) {
   System.out.println(entry.getKey() + "  " + entry.getValue());
}
</code></pre>

<p>The output is always</p>

<pre><code>6  BB
5  AA
</code></pre>

<p>But I expect to get only <code>6  BB</code>
Even if I decomment commented lines it still produce the same output. As I understand if the key in <code>WeakHashMap</code> has no active reference somewhere else outside this <code>weakHashMap</code> the entry with the specified key has to be removed. Am I right? If no, please, suggest the right solution.</p>
