Beware of rules of leftshift and ternary operator rules of precedence in Groovy

I was wondering why toURL() was returning a String. Thought I was going bonkers!

Then I realised that leftshift operator ‘<<‘ was adding (it) to the collection, instead of having the ternary operation (? : ) complete.

Wrapping the expression in parentheses restored my sanity. Thought it was an odd one!

Not so Groovy in my eyes… :-)


About this entry