> +1 for that but even if you are not using a db, this is a clear duplicate.
> You should refactor your code. Data would go into a file (xml or csv) and
> your method would be only a couple of lines of code.
So you are saying that XML or CSV is better than Java? Its all just
text, and there is nothing vaguely type safe about CSV.
I don't buy this at all. I see nothing duplicative about having
Immutable data. Once you have that, then
the choice of file format is an engineering decision, or perhaps
personal preference.
Going from the fairly clean code in the Java class to XML would be
much more verbose and error prone, and a step backwards IMHO.
My class has no real code in it, nothing executable. Its all just
data.
This is moving off into philosophy or theology, not addressing the
fundamental question. But so far, the idea that a Relational DBMS or
XML is better is pretty much ungrounded.