Jim,
Thanks so much for taking on that charge! Jim, you certainly are a Java Guru and I bet that it took you no longer than ten minutes to write that code. I also know you did not
test your code
there is one compile error in the inc() helper -- D should be totD. Otherwise, it works.
I tried to retain as much Perl-like crypticism as possible in Java for the same basic algorithm. Well,
different strokes for different folks , that's why some people love (or hate) Perl! The
crypticism is just
the Perl way. On the other hand,
the Java way is specifically the verbose way. When I said verbosity I really meant to follow the same algorithm the way I attacked the problem, but do it in
the Java way. Moreover, despite you being cryptic with Java the code is still 3 times the size of the Perl solution, and believe me I could made it even shorter but I wanted to stay out of the obfuscation zone. (Yeah right, you are already there
)
How about sorting the output? In Perl you simply would say:
Adding sorting was simple! Now let's see what how much we must add to the "CSVParse" code?
I was making a case in point that the problem lends itself to Perl. BTW, originally I did it with a Perl one liner:
However, than my solution is good only on *nix boxes, and I wanted to provide a portable solution. So the real point was, its just much simpler with Perl. (Of course, once you're comfortable with the Perl way
) Not to mention that you still have the compile-and-run phase in Java
In any case I hope we helped Clare. And Jim if you have a chance please modify the CSVParser to sort the output.
Regards,
Leslie
[ February 21, 2003: Message edited by: Leslie Chaim ]