I suggest reading up on Groovy Truthiness:
http://groovy-lang.org/semantics.html#Groovy-Truth
There are a few things the resolve to boolean "false" when you put a
non-boolean into a boolean space.
On Mon, Apr 11, 2016 at 4:27 PM, Henrik Martin wrote:
> Sure, it makes sense. I guess my confusio
Sure, it makes sense. I guess my confusion originated in other uses with
Strings. Like this:
foo = 'hello'
foo = foo ?: 'goodbye' // foo == 'hello'
where foo ends up being set to 'hello'. I guess a String as the left
hand side expression of the Elvis operator evaluates to itself instead
of bo
Well, you seem to know what's happening.
sleepFor = sleepFor > 0 ?: 10
is equivalent to:
sleepFor = (sleepFor > 0 ) ?: 10
So the entire expression (sleepFor > 0) is evaluated and, if found to be
true, returned as the result of the elvis expression.
Elvis operator like this:
Z = X ?: Default
is eq
And of course I meant to say "... and my println statement prints 10",
not 910. :-)
-H
On 4/12/16 12:41 AM, Henrik Martin wrote:
Greetings. I ran into this little surprise with the Elvis operator
today. I guess it must boil down to my misunderstanding of how the
operator work. I have a method
Greetings. I ran into this little surprise with the Elvis operator
today. I guess it must boil down to my misunderstanding of how the
operator work. I have a method that tries to calculate a value based on
an input. If the input value is set to -1, I'd like to change it to a
positive value (whi
Hi all,
As a fun learning experience I am attempting to move an application's
Spring configuration from XML to Groovy. I need to create a bean for a
Groovy class that is annotated with @Immutable.
Let's say my class is this:
@Immutable
class MyImmutableClass {
String someString
String ot
I have a requirement in my application to receive xml files from a user and
filter out specific nodes based on a configuration option ( accepts GPath
String ).
This is fine.
I can use XmlSlurper to parse the file and with the defined GPath I can find
and remove the node and rewrite the file.
My
*>you wrote there are 20 such replacement cases... executing 20 scripts is
hardly a problem, so it must happen in a loop...*
Sorry, didn't understand, what do you mean by loop?
*>do you reuse the scripts, or do you make a new script each time? *
I suppose I do reuse, please have a look at "ScriptF
On 10.04.2016 20:52, Serega Sheypak wrote:
> org.codehaus.groovy.vmplugin.v7.Selector$MethodSelector.doCallSiteTargetSet
I see this method after switching to indy version with invkoedynamic
That is a hint, that you have a lot of invalid callsites going on
What does it mean? What can I do in