Skip to main content

Practice · 3 of 3

hashCode/equals in action

CHALLENGE
Difficulty: beginner+25 XP

Inside Solution, write static java.util.HashSet<String> dedupe(java.util.List<String> words) returning a HashSet of the distinct words. Then write record Slug(String raw) whose compact constructor lowercases and trims the raw value — so that new Slug(" A ") equals new Slug("a") and both collapse to one entry in a HashSet.

Back to lesson: Practice: Practice: Modeling Data