Linked Hash Set:
1)LinkedHashSet implementation is a subclass of the HashSet class. It works similarly to a HashSet, except for one important detail. Unlike a HashSet, a LinkedHashSet guarantees that the iterator will access the elements in insertion order, that is, in the order in which they were inserted into the LinkedHashSet.
2)This implementation differs from HashSet in that it maintains a doubly-linked list running through all of its entries.
3)The initial capacity (i.e., the number of buckets in the hash table) and its load factor (i.e., the ratio of number of elements stored to its current capacity) can be tuned when the set is created. The default values for these parameters will under most circumstances provide acceptable performance.
Use tips:
A LinkedHashSet is an ordered version of HashSet that maintains a doubly-linked List across all elements. Use this class instead of HashSet when you care about the iteration order. When you iterate through a HashSet the order is unpredictable, while a LinkedHashSet lets you iterate through the elements in the order in which they were inserted.
Resources:
You can reference the following URL to see the comparison among TreeSet,HashSet and LinkedHashSet:
[url]http://vidyapsi.wordpress.com/2009/01/22/treeset-vs-hashset-vs-linkedhashset/[/url]
Also you can reference the follwoing URL for more details about Set:
[url]http://java4coders.com/tag/linkedhashset-vs-hashset/[/url]
1)LinkedHashSet implementation is a subclass of the HashSet class. It works similarly to a HashSet, except for one important detail. Unlike a HashSet, a LinkedHashSet guarantees that the iterator will access the elements in insertion order, that is, in the order in which they were inserted into the LinkedHashSet.
2)This implementation differs from HashSet in that it maintains a doubly-linked list running through all of its entries.
3)The initial capacity (i.e., the number of buckets in the hash table) and its load factor (i.e., the ratio of number of elements stored to its current capacity) can be tuned when the set is created. The default values for these parameters will under most circumstances provide acceptable performance.
Use tips:
A LinkedHashSet is an ordered version of HashSet that maintains a doubly-linked List across all elements. Use this class instead of HashSet when you care about the iteration order. When you iterate through a HashSet the order is unpredictable, while a LinkedHashSet lets you iterate through the elements in the order in which they were inserted.
Resources:
You can reference the following URL to see the comparison among TreeSet,HashSet and LinkedHashSet:
[url]http://vidyapsi.wordpress.com/2009/01/22/treeset-vs-hashset-vs-linkedhashset/[/url]
Also you can reference the follwoing URL for more details about Set:
[url]http://java4coders.com/tag/linkedhashset-vs-hashset/[/url]