Java Collections Tutorials 05 | HashSet and LinkedHashSet in java | Java9s.com

Опубликовано: 07 Апрель 2016
на канале: java9s
14,272
92

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...  


На этой странице сайта вы можете посмотреть видео онлайн Java Collections Tutorials 05 | HashSet and LinkedHashSet in java | Java9s.com длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь java9s 07 Апрель 2016, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 14,272 раз и оно понравилось 92 зрителям. Приятного просмотра!