Thursday, 1 May 2014

HashSet Vs LinkedHashSet

  1. 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.
  1. LinkedHashSer uses LinkedHashMap internally, where as HashSet uses HashMap.
  1. 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.

Prevoius                                                 Next                                                 Home

No comments:

Post a Comment