Skip to content

HashSet

Sharina Stubbs edited this page Sep 19, 2019 · 3 revisions

Pros

  • Holding pieces of data
  • Great for checking to see if something exists
  • Really fast for checking if something exists
  • it's constant time to add something to set, so they're really fast
  • It's like a hashmap except it only has values.

Cons

  • An unordered collection of data

Example

See Code Fellows 401 Java lecture notes

... for use of a HashSet to check for specific words in a text document, specifically in Alice in Wonderland: https://github.com/codefellows/seattle-java-401d6/blob/master/class-03/alice/src/main/java/alice/App.java

Clone this wiki locally