Return-Path: X-Original-To: apmail-groovy-users-archive@minotaur.apache.org Delivered-To: apmail-groovy-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 89539190FE for ; Tue, 29 Mar 2016 12:14:17 +0000 (UTC) Received: (qmail 62569 invoked by uid 500); 29 Mar 2016 12:14:16 -0000 Delivered-To: apmail-groovy-users-archive@groovy.apache.org Received: (qmail 62541 invoked by uid 500); 29 Mar 2016 12:14: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 62531 invoked by uid 99); 29 Mar 2016 12:14: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; Tue, 29 Mar 2016 12:14: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 4FDCB1A5A4B for ; Tue, 29 Mar 2016 12:14:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.821 X-Spam-Level: X-Spam-Status: No, score=-0.821 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-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 i5x61S_8vSxa for ; Tue, 29 Mar 2016 12:14:14 +0000 (UTC) Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id A4FBE5F24D for ; Tue, 29 Mar 2016 12:14:13 +0000 (UTC) Received: by mail-wm0-f54.google.com with SMTP id p65so136217746wmp.1 for ; Tue, 29 Mar 2016 05:14:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=gc3IfFXhgZnKebiiL22ndWetPZn4iVu7XZmOsfa8jgM=; b=U2QKrupZB9Sn7RucxBJHPs38xZ0WhI58Kbv4brTJ8SZJX0Ii5ikyO4O1IIHaypYRhP AeBzezyho0rPnuFrYgzi42vSVUokfN5etTslTw+FYrltURSZYa2MHIuMtU13+lekawDj mMPY0tqxj3ipghMM0UdG3e300flNlXqby3K7W3GxPb3udL2OSDce6bgJIvw8yfybJnju XjGgd2IhH11gOaf3wJSnAsbiwyK0hqCfrp3mhpJfB1dUjSVOebFE3u/z3HHrV5+vtYbI HpNOq2WeAN0vNpv2YGmJBbEt1lJEgDpr8Eq8/Bk6QHZZiUBUAwGpCQmhwwtKN/Y6JI6d JqMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=gc3IfFXhgZnKebiiL22ndWetPZn4iVu7XZmOsfa8jgM=; b=SIVYQZUPj4VPYw5mcJTEKRRFhFbr9eVAU3Gr7qV82zZFgoSfXMaExww8GYz5OPP2uH iXJ2lXN9hqKzPXY8rtsBJBK2f+SpKYwuaasGyvLANPtdQyrv/wM/VjUSYY4NPoWzVDQB Kt+lTpyRd0r7oQIHZmfQDTAgzIIvZmEXFVYTdH4O8BHIvG+0GQWMbBxq7Kxps2/s1rZk SS9gzgXQcwj0LUD6H9grqeDYX2jq6AEAGo+pkL9LwvsFJ3DZm7I7yi07qxZVYxnzYAqh nyH1/7oXt+nA4uv+WNQaDGqMbmC8eRjI6yP1lJiRdvzlxX7UgKTm8y0G4Kh80gIez8Ol ov1w== X-Gm-Message-State: AD7BkJIHtpSbkE2g2vEvk+rk9eSrcJbXfNBk+8yVjC8JZXJrYYDQ5AxhgEvyFc4+8N+uvwN1Dq7nErnJwJNiww== X-Received: by 10.28.15.211 with SMTP id 202mr15183505wmp.31.1459253653391; Tue, 29 Mar 2016 05:14:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.5.163 with HTTP; Tue, 29 Mar 2016 05:13:53 -0700 (PDT) In-Reply-To: References: <56FA5814.8090700@gmx.com> From: =?UTF-8?B?RGlua28gU3Jrb8SN?= Date: Tue, 29 Mar 2016 14:13:53 +0200 Message-ID: Subject: Re: Check if List is of specific size and elements of specific type To: users@groovy.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 29 March 2016 at 14:07, S=C3=B8ren Berg Glasius (GR8Conf EU) wrote: > @dinko yeah, that's why I choose to do my example with > listVariable*.getClass() Yeah, I know. :-) One needs to get burned once or twice in order to learn (one =3D=3D me, but I imagine I'm not alone ;-) ). - Dinko > > Best regards, > S=C3=B8ren Berg Glasius > GR8Conf Europe organizing team > > GR8Conf ApS > Mobile: +45 40 44 91 88, Web: www.gr8conf.eu, Skype: sbglasius > Company Address: Buchwaldsgade 50, 5000 Odense C, Denmark > Personal Address: Hedevej 1, Gl. Rye, 8680 Ry, Denmark > --- GR8Conf - Dedicated to the Groovy Ecosystem > > From: Dinko Srko=C4=8D > Reply: users@groovy.apache.org > Date: March 29, 2016 at 14:04:50 > To: users@groovy.apache.org > Subject: Re: Check if List is of specific size and elements of specific > type > > On 29 March 2016 at 12:29, Marcos Carceles > wrote: >> Would this work? >> >> listVariable*.class =3D=3D [Integer, Integer] > > It would in this particular example, but this may be dangerous for > some other cases. Try e.g. this: > > [1, [:], [class: 1]]*.class > > Cheers, > Dinko > >> >> On 29 March 2016 at 12:25, Maarten Boekhold wrote: >>> >>> Hi, >>> >>> Is there a quick and easy way to do something like: >>> >>> assert listVariable =3D=3D [int, int] >>> >>> eg, the list is of size 2 and each element is an int? >>> >>> Maarten >> >>