groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anand (JIRA)" <j...@apache.org>
Subject [jira] [Created] (GROOVY-7908) groovy default list.find == item is giving false even if the item is present
Date Tue, 16 Aug 2016 09:08:20 GMT
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)

Mime
View raw message