Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 50100 invoked from network); 2 Aug 2006 06:58:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Aug 2006 06:58:46 -0000 Received: (qmail 26364 invoked by uid 500); 2 Aug 2006 06:58:35 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 26289 invoked by uid 500); 2 Aug 2006 06:58:35 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 26193 invoked by uid 99); 2 Aug 2006 06:58:34 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Aug 2006 23:58:34 -0700 X-ASF-Spam-Status: No, hits=1.9 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: 202.81.18.152 is neither permitted nor denied by domain of smallsmallorgan@gmail.com) Received: from [202.81.18.152] (HELO ausmtp04.au.ibm.com) (202.81.18.152) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Aug 2006 23:58:32 -0700 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp04.au.ibm.com (8.13.6/8.13.5) with ESMTP id k7274FOo109314 for ; Wed, 2 Aug 2006 17:04:15 +1000 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.250.244]) by sd0208e0.au.ibm.com (8.13.6/8.13.6/NCO v8.1) with ESMTP id k726u8pj112968 for ; Wed, 2 Aug 2006 17:01:29 +1000 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id k726iMOE021081 for ; Wed, 2 Aug 2006 16:44:22 +1000 Received: from d23m0011.cn.ibm.com ([9.181.32.74]) by d23av03.au.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id k726iJ3x019759 for ; Wed, 2 Aug 2006 16:44:22 +1000 Received: from [127.0.0.1] ([9.181.106.176]) by d23m0011.cn.ibm.com (Lotus Domino Release 6.5.5HF262) with ESMTP id 2006080214440263-20217 ; Wed, 2 Aug 2006 14:44:02 +0800 Message-ID: <44D0499A.6050601@gmail.com> Date: Wed, 02 Aug 2006 14:43:38 +0800 From: Spark Shen User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: harmony-dev@incubator.apache.org Subject: [classlib][luni] Is fully comply with Comparator.compare(T, T) necessary (Re JIRA harmony 1026) X-MIMETrack: Itemize by SMTP Server on D23M0011/23/M/IBM(Release 6.5.5HF262 | April 5, 2006) at 02/08/2006 14:44:02, Serialize by Router on D23M0011/23/M/IBM(Release 6.5.5HF262 | April 5, 2006) at 02/08/2006 14:44:22, Serialize complete at 02/08/2006 14:44:22 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I constructed a MockComparator as below: public static class MockComparator implements Comparator { public int compare(T o1, T o2) { if(null == o1) return -1; if(o1.equals(o2)) { return 0; } return 1; } } This comparator regards null as the smallest object and TreeMap uses this Comparator as a null-tolerable comparator. And this comparator is used to test the behavior of TreeMap.headMap() when the input is null. Since null is recognized as smallest, the expected length of the returned SortedMap of TreeMap.headMap(null) will be zero. My point here is that, under this situation, the MockComparator does not care about the order of non-null objects, it just know null is always smaller. So, is it acceptable that - in this comparator, compare method does not judge the order of all the non-null objects? (does not comply with doc of comparator.compare) Best regards -- Spark Shen China Software Development Lab, IBM --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org For additional commands, e-mail: harmony-dev-help@incubator.apache.org