I've created a Hashtable with a String as key and a LinkedList of Strings as my value. Here is my implementation:
Hashtable <String, LinkedList<String>> table = new Hashtable <String, LinkedList<String>>();
What I want to do is sort a file of words and store each sorted word into the hashtable (represents the key) and the store the ORIGINAL word as part of my LinkedList value.
For example, if word is
"cat"
Sorted = "act"
Store in Hashtable (key : act, value : cat);
Now I'm just getting confused how to essentially add to my LinkedList.
This is what I was thinking :
LinkedList <String> temp = table.get(sortedWord) //if null, then nothing in list
if(temp==null)
table.put(sortedWord,temp.add(originalWord));
This is not working since its not following the library functions but I'm unsure of how I would do this.