Q:

Ignore certain words when reading a file

My program reads a text file and lists the frequencies of each word in the file. What I need to do next, is ignore certain words such as 'the','an' when reading the file. I have a created a list of these words but not sure how to implement it in the while loop. Thanks.
public static String [] ConnectingWords = {"and", "it", "you"};

public static void readWordFile(LinkedHashMap<String, Integer> wordcount) {
    // FileReader fileReader = null;
    Scanner wordFile;
    String word; // A word read from the file
    Integer count; // The number of occurrences of the word

    // LinkedHashMap <String, Integer> wordcount = new LinkedHashMap<String, Integer> ();

    try {
        wordFile = new Scanner(new FileReader("/Applications/text.txt"));
        wordFile.useDelimiter(" ");
    } catch (FileNotFoundException e) {
        System.err.println(e);
        return;
    }
    while (wordFile.hasNext()) {
        word = wordFile.next();
        word = word.toLowerCase();

        if (word.contains("the")) {
            count = getCount(word, wordcount) + 0;
            wordcount.put(word, count);

        }
        // Get the current count of this word, add one, and then store the
        // new count:
        count = getCount(word, wordcount) + 1;
        wordcount.put(word, count);
    }
}

A:

Create one list which will have list of word need to ignore as:
List<String> ignoreAll= Arrays.asList("and","it", "you");

then in while loop add one condition that will ignore the word contains these words as
if(ignoreAll.contains(word)){
                 continue;

            }

