Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4D09C200B71 for ; Tue, 16 Aug 2016 14:33:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4BCCB160A76; Tue, 16 Aug 2016 12:33:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 911A8160AA8 for ; Tue, 16 Aug 2016 14:33:21 +0200 (CEST) Received: (qmail 88482 invoked by uid 500); 16 Aug 2016 12:33:20 -0000 Mailing-List: contact notifications-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list notifications@groovy.apache.org Received: (qmail 88454 invoked by uid 99); 16 Aug 2016 12:33:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Aug 2016 12:33:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 7B8082C0032 for ; Tue, 16 Aug 2016 12:33:20 +0000 (UTC) Date: Tue, 16 Aug 2016 12:33:20 +0000 (UTC) From: "Anand (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GROOVY-7908) groovy default list.find == item is giving false even if the item is present MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 16 Aug 2016 12:33:22 -0000 [ https://issues.apache.org/jira/browse/GROOVY-7908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15422669#comment-15422669 ] Anand commented on GROOVY-7908: ------------------------------- Closing found out this is not a bug. list.find() returns first truth value. > 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)