Try to find two words with the same hash code in a large file, such as the /usr/share/dict/words file on a Linux system. Keep a Map<Integer, HashSet<String>>. When you read in a word, compute its hash code h and put the word in the set whose key is h. Then iterate through all keys and print the sets whose size is > 1.

Complete the following file:

SameHashCode.java

import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; public class SameHashCode { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(System.in); System.out.println("Enter file name: "); String filename = in.nextLine(); File reader = new File(filename); Scanner fileIn = new Scanner(reader); Map<Integer, HashSet<String>> wordMap = new HashMap<Integer, HashSet<String>>(); /* Read words from file and add them to wordMap */ while (fileIn.hasNext()) { . . . } fileIn.close(); /* Now iterate through all keys and print the sets whose size > 1. */ for (. . .) { Set<String> wordList = . . . if (. . .) { System.out.println(wordList); } } } }