In the book ‘A Programmer’s guide to Java SCJP certification by Khalid Mughal – 3rd ed.’, on page 782, i noticed that it says that concrete class HashSet is implemented using hash table and linked list. When i browse through the main java tutorial website http://download.oracle.com/javase/tutorial/collections/implementations/index.html, it doesn’t seem to be true. Please advice. Thanks.
Share
HashSetis a wrapper forHashMapwhich in turn use an array.HashMapis a hash table but not theHashtableclass. HashSet doesn’t have anything to do with a list except to resolve collisions.LinkedHashSetalso has a linked list of its own, but does not use theLinkedListclass.