You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Anand (JIRA)" <ji...@apache.org> on 2016/08/16 09:08:20 UTC

[jira] [Created] (GROOVY-7908) groovy default list.find == item is giving false even if the item is present

Anand created GROOVY-7908:
-----------------------------

             Summary: groovy default list.find == item  is giving false even if the item is present
                 Key: GROOVY-7908
                 URL: https://issues.apache.org/jira/browse/GROOVY-7908
             Project: Groovy
          Issue Type: Bug
          Components: groovy-jdk
    Affects Versions: 2.4.7
         Environment: Ubuntu 16.04
            Reporter: Anand
            Priority: Minor


For the following script,
{code} def names = []
names << "Anand"
names << "Aditya"
names << "Abhi"

def searchItem = "bug"

if (names.find() == searchItem)
    println "item found "
else
    println "Item not found "

println "adding the Item"

names << searchItem

println "Item added"
println "values: $names"
println "trying again"

if (names.find() == searchItem)
    println "Item found "
else
    println "Item still not found "  {code}

In list there first the search item is not present and it has yielded false but then i added the item and still find method is giving false. The opposite case work well i.e if initially item is there it gives true and then if i remove it then it gives false.
Is it how it is designed to work or is this a bug.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)