// OffensiveWords.java // // Informatics 102 Spring 2012 // Assignment #1 // // This class consists of one static method that returns a list of the // words that are considered offensive. Your aspect must take its list // of offensive words from this class, so that we can plug in our own list // of offensive words (by replacing this class with a new one that has a // different list of words in it) for grading purposes. // // The list returned by this class is not permitted to be modified. Any // attempt to modify it results in an UnsupportedOperationException. import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; public class OffensiveWords { private static String[] offensiveWordsArray = { "alex", "thornton", "monkie" }; private static List offensiveWords; static { offensiveWords = new ArrayList( Arrays.asList(offensiveWordsArray)); } public static List getOffensiveWords() { return Collections.unmodifiableList(offensiveWords); } }