Set, HashSet, and SortedSet
One of the concrete classes that implements Collection is java.util.HashSet. We briefly visited HashSet at the beginning of this section on Collections, and now it is time to expand on it a little. This class is just a plain old “Data Structures 101” hash table.
You provide each object that will be stored as data in the hash table, and the library class does the work of maintaining the table and putting the elements in the right places. You start by instantiating an empty HashSet, then anything you add is placed in the table. If an object is already in the table, it won't be added again.
The class HashSet implements Set which implements Collection. The exact parent-child relationship of interfaces is shown in ...