Worked example
Set<String> seen = new HashSet<String>();
seen.add("Ada");
seen.add("Sam");
seen.add("Ada"); // duplicate — ignored
System.out.println(seen.contains("Ada")); // true
System.out.println(seen.contains("Bo")); // false
System.out.println(seen.size()); // 2, not 3
Even though add("Ada") was called twice, the set holds "Ada" once.