I have a comma delimited configuration file. The empty lines are ignored and there need to be errors on invalid lines:
foo,bar
foo2, bar3
I want to read this file into a HashMap where the key (foo) is mapped with a value (bar).
What is the best way to do this?
If you can use x = y instead of x, y then you can use the Properties class.
If you do need to have x, y then look at the java.util.Scanner you can set the delimiter to use as a separator (the javadoc shows examples of doing that).
and the Properties version (way simpler for the parsing, as there is none)