Use a hashmap with string as key and list(string) as value where list of strings contain all anagrams of a key string.
The question is similar to "find all anagrams of a word in a file"
View algo and code here http://justprogrammng.blogspot.com/2012/06/determine-anagrams-of-word-in-file.html