I'm sorry, it compiles, but doesn't write to the file, and I get the runtime exception:
Exception in
thread "main" java.util.NoSuchElementException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:796)
at java.util.HashMap$KeyIterator.next(HashMap.java:828)
at java112.tests.TestCode.run(TestCode.java:68)
at java112.tests.TestCode.main(TestCode.java:21).
Methinks I should be iterating this BEFORE my finally block closes the FileWriter, which WILL then write to the file if coded this way:
However, I get the same runtime exception:
General Error
java.util.NoSuchElementException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:796)
at java.util.HashMap$KeyIterator.next(HashMap.java:828)
at java112.tests.TestCode.run(TestCode.java:42)
at java112.tests.TestCode.main(TestCode.java:21)
And I don't really understand what this means. It seems to indicate that at some point there is no iteration of the HashSet when it expects there to be one, but I'm not clear on exactly when that is, or why.
The app writes some of the unique tokens from the input file on separate lines with no other delimiters, but not all of them.