Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 48453 invoked from network); 21 May 2010 08:28:42 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 May 2010 08:28:42 -0000 Received: (qmail 41786 invoked by uid 500); 21 May 2010 08:28:42 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 41720 invoked by uid 500); 21 May 2010 08:28:42 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 41712 invoked by uid 99); 21 May 2010 08:28:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 May 2010 08:28:42 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [62.179.121.34] (HELO viefep14-int.chello.at) (62.179.121.34) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 May 2010 08:28:34 +0000 Received: from edge03.upcmail.net ([192.168.13.238]) by viefep14-int.chello.at (InterMail vM.8.01.02.02 201-2260-120-106-20100312) with ESMTP id <20100521082813.FMRN18535.viefep14-int.chello.at@edge03.upcmail.net> for ; Fri, 21 May 2010 10:28:13 +0200 Received: from [192.168.1.50] ([84.74.100.246]) by edge03.upcmail.net with edge id L8UB1e05H5JxopQ038UC7c; Fri, 21 May 2010 10:28:13 +0200 X-SourceIP: 84.74.100.246 Message-ID: <4BF6441B.8060203@apache.org> Date: Fri, 21 May 2010 10:28:11 +0200 From: Felix Knecht Reply-To: felixk@apache.org User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100509 Thunderbird/3.0.4 MIME-Version: 1.0 To: Apache Directory Developers List Subject: Re: equals() implementation in ProtectedItem References: <4BF528A7.9060006@otego.com> <4BF62BFC.30705@apache.org> In-Reply-To: <4BF62BFC.30705@apache.org> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=tsaDvxd5BMYuajhtvJLL+Ppe47iaIgCGP4JcOtoQkcg= c=1 sm=0 a=qvm2wiHSeTwA:10 a=ood2b7iyd8MA:10 a=pXoq77xVGrQA:10 a=8nJEP1OIZ-IA:10 a=mV9VRH-2AAAA:8 a=cexIBkohAAAA:8 a=xe8BsctaAAAA:8 a=RXxl4_Sb14NLzOi8gHQA:9 a=8Z2VApkR9WnEca9z9-IA:7 a=k9m-nKTlxxlBtrcDokxYnJZguZkA:4 a=wPNLvfGTeEIA:10 a=-3MEPEn4s8gA:10 a=1b0UEgISMIkA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Virus-Checked: Checked by ClamAV on apache.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >> Are you aware, that this [1] is an equal of collections and will return >> in most cases "false" as it is a reference comparison [2]? Thanks to test cases :) > > I checked the history. Previously we didn't use > Collections.unmodifiableCollection( attributeTypes ) > And a quick check shows that the callers of the construtor always pass > an java.util.Set. > > For two Sets the equals method would work correctly, but the creation of > the unmodifyalbe collection not. > > I think we have two options: > - use CollectionUtils.isEqualCollection() from commons collections, this > seems to do the right thing. > - try to change the parameter type from Collection to Set in the > constructors and use Collections.unmodifiableSet() instead. > > Thoughts? It dependes on the content we have in the collections. Set doesn't allows duplicates wheras with certain collection implementations this is possible. >> [1] >> http://people.apache.org/~felixk/shared-docs/xref/org/apache/directory/shared/ldap/aci/ProtectedItem.html#245 >> [2] >> http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#equals%28java.lang.Object%29 > -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkv2RBsACgkQ2lZVCB08qHEMRwCgqw/vU0yLW9MLaxJu84yseUiO LtwAn0L5ez3u/jYUA0CIkfsT68qi371a =hQz9 -----END PGP SIGNATURE-----