Hi there, I'm the author =D
I know that Java example wasn't very good, it was just what prompted me to write it. And so ah-ha, here's a good way to learn a bit of Scala instead of re-writting it in Java...
Personally, I find the Scala code much more concise and readable than the equiavalent Java code. That makes it much easier to ensure that it's correct, and easy to modify. I love getting rid of the for loops, the indexes etc etc, no need to have to do any math in my head to understand the code :) Yes yes, I am a very lazy programmer ;)
Regarding keeping things "readable and familiar:", i'm sure at one stage all Java was not readable or familiar to you, so you learnt the language, and discovered that Java was far more concise, powerfull, flexible, readable etc than things before it. I would hope you're not going to stick to Java for the rest of your life?
Once you've accepted that you are going to learn a new language, Scala, Groovy etc the power that come along with the language make it clear that they are more powerfull and higher level than Java.
Not sure what you're referring to here:
"...and the author shouldn't blame Java for his implementation not supporting "is"... what's that all about?"
Cheers.
P.s. even shorter:
var loves = "loves".toList map( x => "roger federer maria sharapova".toList count(x == _ ))
while (loves.length > 1)
loves = loves zip(loves tail) map {x => x._1 + x._2}
println("3 line compatibility = " + loves.head * 2 + " %")
|