As the title says, I have an arraylist of over 10000 words and I wish to use another arraylist of words where I chose the words to search for. Cant explain it more simple than that but there's the code you may catch on to what I am trying to achieve. Basically, one arraylist of a lot of words then another arraylist of 5 or so words that will check if those words appear in the long arraylist of words.
//TO DO: Profile the search method
try {
Scanner input = new Scanner(new File("textFile.txt"));
int reps = 100;
List<String> list = new ArrayList();
List<String> searchValues = new ArrayList();
searchValues.add("You");
searchValues.add("and");
searchValues.add("So");
searchValues.add("we");
searchValues.add("important");
while (input.hasNext()) {
list.add(input.next());
}
input.close();
System.out.println("Amount of words in a .txt file: " + list.size());
//Start to time the method
long start = System.currentTimeMillis();
for (int i = 0; i < reps; i++) {
for (int j = 0; j < list.size(); j++) {
//List value = index.search(list.get(j));
List value = index.search(list.get(j));
}
}
long end = System.currentTimeMillis();
System.out.println("Time Taken: " + (end - start) + "ms");
} catch (IOException exc) {
System.out.println("File does not exist");
exc.printStackTrace();
System.exit(1);
}