How it works...

As a HashSet is a kind of HashMap, most of its interface is pretty similar. The major difference is that the methods that would return a key's value in the HashMap instead simply return a bool on the HashSet in order to tell if a key already existed or not [14].

Additionally, HashSet brings a few methods for analyzing two sets [46 to 92] and joining them [96 to 131]. If you've ever heard of set theory or Venn diagrams, or done a bit of SQL, you're going to recognize it all. Otherwise, I advise you to run the example, and study the outputs in combination with the relevant comments.

Some illustrations might help you. For the analytical methods, the dark green part is the object of reference:

For the selecting methods, the dark green part is the one that is returned:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.18.218