-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
In a Pipeline ArrayList.empty is applied to each element of the list and returns another ArrayList.
In a normal console Groovy script ArrayList.empty returns a boolean value which answers, whether the list empty or not.
What is the reason for this difference? Is it expected or a bug? I always thought that when I call Java class method in the Pipeline script it should work like in Java. From this point of view it seems as a bug.
Example:
def listA = [] def listB = [ "1", "2", "3" ] println('listA.empty=' + listA.empty) println('listB.empty=' + listB.empty)
Groovy command line output:
listA.empty=true
listB.empty=false
Pipeline output:
listA.empty=[]
listB.empty=[false, false, false]