Tuesday, November 8, 2016

Java Collection Properties One by One



  1. The nature of Sets that there are no duplicates.
  2. The advantage of using a TreeSet is that it not only remove the duplicates, but also sorts the Data in Ascending order.
  3. The HashSet does not preserve the ordering the Set, so it can be used if you are not interested in ordering.
  4. The LinkedHashSet keeps the original ordering of the Set. So it is advisable to be used if you want to keep the original ordering of your Set!

No comments:

Post a Comment