Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #10186

Re: case insensitive sort

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Tue, 22 Nov 2011 23:59:50 -0600
Date Tue, 22 Nov 2011 21:59:50 -0800
From Patricia Shanahan <pats@acm.org>
User-Agent Thunderbird 1.5.0.2 (Windows/20060308)
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: case insensitive sort
References <nfvoc7t69mjhbed81u75k9v1j1nn4pcu73@4ax.com>
In-Reply-To <nfvoc7t69mjhbed81u75k9v1j1nn4pcu73@4ax.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Message-ID <6vqdnf10be9KFlHTnZ2dnUVZ_rudnZ2d@earthlink.com> (permalink)
Lines 17
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 70.230.194.31
X-Trace sv3-Bax9nddHeUgQfginvio19ICpFJbiMP/mhC6BP3iN1Y+t1llwTYx02Cb64wtjz/ALFCohs8sl0P55rm4!VPbAPUE5iSpNNGx0FAfrcNiX0kIeC/R3v3z6y0VQ2DaTjCBmg+ejpVIyaHeAbss0KNMIFOloynLb!Tqrfb3T3pGYjq7ktR8OcYITKO0PUbJqR8R4DOoS2VXpqXw==
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 1675
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10186

Show key headers only | View raw


Roedy Green wrote:
> When someone asks for a case insensitive sort, they typically use code
> like this in the Comparator
> 
> return a.x.compareToIgnoreCase( b.x );
> 
> However than will not give you what you really want.  You probably
> want this if you want tidy-looking results.
> 
> int diff = a.x.compareToIgnoreCase( b );
> if ( diff != 0 ) return diff;
> return a.x.compareTo( b.x );

I think this needs more context. What is x? What are the types involved?
Why do you expect a.x and be to be comparable?

Patricia

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

case insensitive sort Roedy Green <see_website@mindprod.com.invalid> - 2011-11-22 21:06 -0800
  Re: case insensitive sort Patricia Shanahan <pats@acm.org> - 2011-11-22 21:59 -0800
    Re: case insensitive sort v_borchert@despammed.com (Volker Borchert) - 2011-11-23 06:34 +0000
      Re: case insensitive sort Roedy Green <see_website@mindprod.com.invalid> - 2011-11-23 02:49 -0800
    Re: case insensitive sort Roedy Green <see_website@mindprod.com.invalid> - 2011-11-23 02:46 -0800
      Re: case insensitive sort Patricia Shanahan <pats@acm.org> - 2011-11-23 05:23 -0800
      Re: case insensitive sort v_borchert@despammed.com (Volker Borchert) - 2011-11-23 19:32 +0000
        Re: case insensitive sort dibs <dibs@dobs.dabs> - 2011-11-23 15:11 -0500
          Re: case insensitive sort v_borchert@despammed.com (Volker Borchert) - 2011-11-24 05:03 +0000
  Re: case insensitive sort Arne Vajhøj <arne@vajhoej.dk> - 2011-11-25 21:26 -0500
    Re: case insensitive sort Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-11-26 14:23 +0000
      Re: case insensitive sort Arne Vajhøj <arne@vajhoej.dk> - 2011-12-02 21:56 -0500
        Re: case insensitive sort Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-12-04 10:43 +0000

csiph-web