http://java9s.com
A Set is a collection of Unique elements.
Set implementation like HashSet, LinkedHashSet and TreeSet should not allow any duplicate object into it.
HashSet is only Unordered and UnSorted. LinkedHashSet is an ordered collection based on the insertion.
Coming to TreeSet, it sorts all its elements so they are ordered based on the sorting criteria.
HashSet is Unordered and Unsorted collection.
It does not allow duplicates and we cannot predict the iteration order.
Then linkedhashSet is ordered as it arranges the elements in the same order as they were inserted.
It also does not allow duplicates
The iterator fetches the elements as they were inserted. So, if you want a collection which should not allow duplicates and should maintain the order, then we can use LinkedHashSet
Complete Generics Tutorials playlist
• Generics in Java Tutorials | Java9s T...
Complete Java Beginners Tutorials:
• Complete Java Tutorials | java progr...
Multithreading in Java tutorial:
• Multithreading in Java Tutorials by J...
Spring 3 MVC Framework tutorials:
• Spring 3 MVC Framework Tutorials
Spring Framework Tutorials:
• Spring Framework Tutorials | Java9s
Design Patterns in Java:
• Design Patterns Tutorials in Java | G...
On this page of the site you can watch the video online Java Collections Tutorials 05 | HashSet and LinkedHashSet in java | Java9s.com with a duration of hours minute second in good quality, which was uploaded by the user java9s 07 April 2016, share the link with friends and acquaintances, this video has already been watched 14,272 times on youtube and it was liked by 92 viewers. Enjoy your viewing!