posted 12 years ago
You are assigning i2 to 33 after inserting i2 into the LinkedHashSet. Now when you try to remove i2, you are actually trying to remove a 33 from the Set which doesn't exist in the Set.
It is similar to,
hs.add(20)
hs.add(25)
and then
hs.remove(33) // 33 doesn't exist in hs. So nothing is removed!!3
When you insert i2 into the set, the set hs stores 25 in it. So when you reassign i2 to 33, the value in hs is unchanged and is 25 only.