Monday, September 28, 2009

A visual comparison of a java to scala port

... of a single class. In this case port was mechanical, I only did to
avoid mixed java/scala source in the one project (which you can of
course do, but I don't like doing it, and it was just one class).

I didn't change the code really (except for dealing with a null, which
is just too nice with a match).

You can guess which one is which (the scala one still ends up a little
bit shorter, mostly due to the constructor magic) but a whole lot more
pleasing to my eye anyway.

Posted via email from Michael's posterous