Could not sort a hashset based on its value . In the below code i have hashset
which contains multiple student information .So want to sort the haset based on the student id.
Below code is not working.Can anyone help me.
The whole point of a hashset is to make it easy/quick to find/insert something. You pass it a key, and a hash value is computed. This is used to determine where to store the actual data.
If you then sort the values inside the hashset, that would move where stuff is. That then means you can't easily find it.
It's kind of like saying "i'm going to put stuff into a sorted list, then randomize it". if you do that, you no longer have a sorted list. If you re-arrange stuff in the hashset, it is no longer a hashset.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com