[Logo]
Forums Register Login
Doubt in function remove in Set
Source : Friends notes, not sure of the original source



The questions are in comments. Please help!
Have a look on the API of remove() method of the HashSet and the equals() method of the Integer class.
thanks Abiraman for the pointer!



I added boolean conditions to test whether the elements are actually being removed or not.
And found that i2 here is not being removed!
how come??
then is it that i2 can now never be removed? i added new statements for remove and size and still the size is shown as 1.
Please help! I am getting confused..
There is no value 47 in the set so why do you think the method should return true?
oh! Now i get it!
thanks Wouter!
i was not thinking in the right direction!
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Nov 22, 2017 17:27:33.