Ch 15: 15.3

Record your participation in Piazza clicker question Lesson24 Q1
There are two classes in the Java library that implement the Set interface. What are they? Click all that apply. (section 15.3)
Set<String> names = new HashSet<String>();
Set<Rectangle> boxes = new HashSet<>();
Record your participation in Piazza clicker question Lesson24 Q2
I want to keep a collection of all my grades for a course I am taking. Since we just learned about sets, I want to try to use a HashSet. Will that work? Think about why or why not.
Record your participation in Piazza clicker question Lesson24 Q3
In your text in section 15.3.2, Dr Horstmann implements a spell check application (opens in a new window) using sets. Could the implementation use an ArrayList for documentWords instead? Think about why or why not.
Record your participation in Piazza clicker question Lesson24 Q4
I want to print all the unique words in a text in alphabetical order. Can I use a set? If so, which implementation should I use?
Record your participation in Piazza clicker question Lesson24 Q5
Suppose you wanted the misspelled words in aphabetical order. You would need to change line 40 of the SpellCheck program to use a TreeSet instead of a HashSet.
Set<String> words = new HashSet<>(); // current line 40
Set<String> words = new TreeSet<>(); // new line 40
What else would need to change?
How would the output change?
Record your participation in Piazza clicker question Lesson24 Q6
What is wrong with the following test to check whether the Set<String> names contains the elements "Thomas", "Diana", and "Harry" and only those elements?
if (words.toString().equals("[Thomas, Diana, Harry]")) . . .
Tree
Binary Tree
Binary Search Tree
