package hw2; import java.util.List; /** * Interface for an object which can check for anagrams. An anagram is a reordering * of the letters in a word or phrase. * */ public interface IAnagramChecker { /** Determine whether one word is an anagram of the other. * Non-alphanumeric characters are ignored. The check is * case-insensitive. CLARIFICATIONS: 1. two strings which have the same alphanumeric characters in the same order are anagrams (case-insensitivity still applies). This, "AB" is an anagram of itself, and "AB" and "aB" and "a B" and "+a-b*" are all anagrams of one another. 2. A string which has no alphanumeric characters has no anagrams. * @param word1 any non-null string. * @param word2 any non-null string. * @return true iff the second word is an anagram of the first. */ boolean isAnagram(String word1, String word2); /** Find all anagrams (if any) of a given word in a dictionary * (list) of words. * @param dictionary a non-null list of strings. * @param word a non-null string. * @return a list of all words from the dictionary which are * anagrams of the given word, using the same criteria as * in method isAnagram. The returned list may be empty but * not null. */ List findAnagrams(List dictionary, String word); }