while (scan.hasNextLine()) {
System.out.println(scan.next());
dictionary.add(scan.nextLine());
}
You check once to see if there's more content, and then you call a form of next()
twice. There is no guarantee that the second call will not fail (as you've found out).