Skip to main content

Practice ยท 3 of 3

Order-Blind Assertions

Implement static Set<String> uniqueTags(String csv) โ€” split on commas, trim each, drop empties, collect as a Set. Then implement static boolean sameContent(List<String> a, List<String> b) returning true when both lists contain the same elements with the same multiplicities โ€” regardless of order (sort copies, or count with a map). The lesson: never assert on a HashSet's iteration order; assert on content instead.

Difficulty: intermediate

Back to lesson: Practice: Testing Lab