I am new to Hashtables, and am trying to understand how they fully work. I need to determine if a string occurs in a large file that contains around 100,000 strings, each on their own line. I have been told that a HashTable would be much more efficient than a LinkedList or ArrayList to runtime being O(n) for both.
I have looked into the HashTable Class in Java, but do not understand how exactly I would enter in every string from the file due to the "put" method needing a key, as well as the object.
I imagine I could use a Scanner to run through every string in my file, but how would I enter them into a Hashtable, and how would the contains() method be utilized in a HashTable?