“Why are you using Fire Fox?” pool

I loved Fire Fox. Really and deeply. But let face the truth, at this moment there are better and faster browsers. I personally use FF because it have one grate feature - Fire Bug. And this is only reason why i don't use Chrome for all the time. So - if you are using Fire Fox - drop your voice.

Groovy List.contains / GString fuss

If you want to search for String value in the List using contains method, be careful if the argument is GString type.

 
def foo = 1
assert !['1','2','3'].contains("${foo}")
assert ['1','2','3'].contains("${foo}".toString())
 

Why? Because contains use equals method to match your parameter to each position on the list, and for equals we have:

 
def foo = "groovy"
def bar = "groovy${''}"
 
assert foo.class == java.lang.String
assert bar.class == org.codehaus.groovy.runtime.GStringImpl
 
assert foo == bar
assert bar == foo
assert !foo.equals(bar)
assert !bar.equals(foo)
 

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.