This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in function remove in Set

 
Rikesh Desai
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Source : Friends notes, not sure of the original source



The questions are in comments. Please help!
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look on the API of remove() method of the HashSet and the equals() method of the Integer class.
 
Rikesh Desai
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no value 47 in the set so why do you think the method should return true?
 
Rikesh Desai
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh! Now i get it!
thanks Wouter!
i was not thinking in the right direction!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic