Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to compare two hashsets ?  RSS feed

 
Vince Hon
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two HashSets,
e.g. hs_1, hs_2
I want to compare these 2 hashsets to produce a new one so that hs_1 will not contain elements of hs_2
Are there any efficient method to do this ?
Thanks
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The compact way:The efficient way:Alternatively, you can just let others worry about things by using the Jakarta Commons Collections:Hope this helps
- Peter
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!