I have a file with several hundreds of stopwords. I want to be able to check if the file has been modified by a user for example or even if it is corrupted.
The way I am thinking of doing it currently is by looking if the number of lines is correct. I could also check if the total number of characters is the one expected or even have the whole stopwords list loaded in memory to check if every single one of them is in the file. All 3 of the ways I thought of seem inefficient and/or bad so I thought of asking if there is any better way of doing it.
What I am thinking of implementing:
private static final int WORD_COUNT = 354;
public static boolean stopwordsCorrupted(File file) {
int numOfLines = countLines(file);
return WORD_COUNT != numOfLines;
}