Sets in Java
Sets are easy to implement in Java using hash tables - the value being stored in the hash table serves as its own key. If someone passes an object and says, "Does this object live in your Set?" you pass that object to the hash function, get your index back, go to the hash's big array, and you either get nothing back (in which case, the answer is no, sorry, it is not in our set) or you get an object back - the same object - with the same hash. And the fact that you find something means the answer is, yes, this object is in the set.
So a Set is just an object wrapping a hash table.
Set class in Java API docs: https://github.com/openjdk/jdk7-jdk/blob/master/src/share/classes/java/util/Set.java
AbstractSet class in Java API docs: https://github.com/openjdk/jdk7-jdk/blob/master/src/share/classes/java/util/AbstractSet.java
HashSet class in Java API docs: https://github.com/openjdk/jdk7-jdk/blob/master/src/share/classes/java/util/HashSet.java
TreeSet class in Java API docs: https://github.com/openjdk/jdk7-jdk/blob/master/src/share/classes/java/util/TreeSet.java
Maps and DictionariesPart of Computer Science Notes
Series on Data Structures
Java implementations: SkipList
Flags · Template:MapsFlagBase · e