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 12616200AF5 for ; Thu, 2 Jun 2016 20:25:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 10E93160A51; Thu, 2 Jun 2016 18:25:18 +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 58C04160A3E for ; Thu, 2 Jun 2016 20:25:17 +0200 (CEST) Received: (qmail 81135 invoked by uid 500); 2 Jun 2016 18:25:16 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 81125 invoked by uid 99); 2 Jun 2016 18:25:16 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Jun 2016 18:25:16 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 8E87D1A12C7 for ; Thu, 2 Jun 2016 18:25:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.701 X-Spam-Level: X-Spam-Status: No, score=-0.701 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id uUVKLcuqjZSY for ; Thu, 2 Jun 2016 18:25:14 +0000 (UTC) Received: from mx0a-001cc001.pphosted.com (mx0b-001cc001.pphosted.com [148.163.158.166]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id E61E25F240 for ; Thu, 2 Jun 2016 18:25:13 +0000 (UTC) Received: from pps.filterd (m0091180.ppops.net [127.0.0.1]) by mx0b-001cc001.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u52ILTeD026149 for ; Thu, 2 Jun 2016 14:25:07 -0400 Received: from ghdppa03vpa.hsi.hughessupply.com ([65.248.165.60]) by mx0b-001cc001.pphosted.com with ESMTP id 23ap2b9a22-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 02 Jun 2016 14:25:07 -0400 Received: from pps.filterd (ghdppa03vpa.hsi.hughessupply.com [127.0.0.1]) by ghdppa03vpa.hsi.hughessupply.com (8.15.0.59/8.15.0.59) with SMTP id u52IA8gp023122 for ; Thu, 2 Jun 2016 14:25:06 -0400 Received: from ghddag1dwpc.hsi.hughessupply.com (ghddag1dwpc.hsi.hughessupply.com [11.224.23.139]) by ghdppa03vpa.hsi.hughessupply.com with ESMTP id 2376nq3wg5-1 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 02 Jun 2016 14:25:06 -0400 Received: from GHDDAG1IWPC.hsi.hughessupply.com (11.224.23.189) by GHDDAG1DWPC.hsi.hughessupply.com (11.224.23.139) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Thu, 2 Jun 2016 14:25:05 -0400 Received: from GHDDAG1IWPC.hsi.hughessupply.com ([11.228.2.169]) by GHDDAG1IWPC.hsi.hughessupply.com ([11.228.2.169]) with mapi id 15.00.1156.000; Thu, 2 Jun 2016 14:25:05 -0400 From: "Nelson, Erick" To: "users@groovy.apache.org" Subject: Re: Looping through a hashmap & removing elements Thread-Topic: Looping through a hashmap & removing elements Thread-Index: AQHRvPsu50+A9IXv00asjXWbomkJ3Z/WS+gA Date: Thu, 2 Jun 2016 18:25:04 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.6.4.160422 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [11.224.23.21] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-06-02_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606020218 archived-at: Thu, 02 Jun 2016 18:25:18 -0000 Does something like this work? uidMap.keySet().removeAll(uidMap.findAll{it.key =3D=3D '?'}.keySet()) From: Guy Matz > Reply-To: "users@groovy.apache.org" > Date: Thursday, June 2, 2016 at 11:18 AM To: "users@groovy.apache.org" > Subject: Looping through a hashmap & removing elements Hi! I want to loop through a hashmap and delete some elements based on som= e criteria . . . I thought there would be some slick groovy method - in th= e spirit of findAll, etc. - to do this, but couldn't find it . . . my java= developer workmate suggested: iter =3D uidMap.entrySet().iterator() while (iter.hasNext()) { entry =3D iter.next() key =3D entry.key value =3D entry.value if (bla, blah, blah) { iter.remove() } Is there a groovier way? Thanks! Guy