diff --git a/HashCollisionChecker.java b/HashCollisionChecker.java index 80631a7..a27740e 100644 --- a/HashCollisionChecker.java +++ b/HashCollisionChecker.java @@ -3,12 +3,20 @@ public class HashCollisionChecker { public static int countOfUniqueHashCodes(HashSet set) { // TODO: Implement - return 0; + HashSet unique = new HashSet<>(); + for (T i: set) { + unique.add(i.hashCode()); + } + return unique.size(); } public static int countOfUniqueHashCodes(HashMap map) { // TODO: Implement - return 0; + HashSet unique = new HashSet<>(); + for (K i: map.keySet()) { + unique.add(key.hashCode()); + } + return unique.size(); } public static void main(String[] args) {