cs notebook0
  • Introduction
  • Core Java
  • some notes
  • Data structure&algorithm
  • Garbage Collection
  • HashMap
  • Collection0
  • Collection1
  • Collection2
  • comparatorVScomparable
  • exception0
  • exception1
  • exception2
  • Enum in Java
  • JVM
  • Wrapper Classes in Java
  • String, int convert
  • HashSetVSTreeSetVSLinkedHashSet
  • Pair
Powered by GitBook
On this page

Was this helpful?

HashSetVSTreeSetVSLinkedHashSet

PreviousString, int convertNextPair

Last updated 5 years ago

Was this helpful?

In brief, if you need a fast set, you should use HashSet; if you need a sorted set, the TreeSet should be used; if you need a set that can be store the insertion order, LinkedHashSet should be used.

https://www.programcreek.com/2013/03/hashset-vs-treeset-vs-linkedhashset/