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


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

Re: Did the sort do anything?

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Did the sort do anything?
Date 2011-11-07 02:20 -0800
Organization Canadian Mind Products
Message-ID <l0cfb7d83g6jl7gflv5ra0nn8oo5humfl9@4ax.com> (permalink)
References <4d8fb7l8qb1g820cphr4fh447a9uitlddj@4ax.com>

Show all headers | View raw


On Mon, 07 Nov 2011 01:27:44 -0800, Roedy Green
<see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted
someone who said :

>What is the easiest way to determine if a sort actually changed the
>order?
I decided to write an inOrder class with four methods, to handle
arrays/Lists Comparables/Comparators.

As usual the Generics befuddled me. So I decide to have a look at
Arrays.sort and Collections.sort to cannibalise.

To my astonishment, the signature of Arrays.sort looks like this:

 public static void sort(Object[] a) {

Surely they mean Comparable?  But when you do that, you get a mess of
unchecked errors. What gives?

Oddly the three more complex methods compile fine.

Did Sun just throw in the towel on doing the generics?
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Capitalism has spurred the competition that makes CPUs faster and 
faster each year, but the focus on money makes software manufacturers 
do some peculiar things like deliberately leaving bugs and deficiencies
in the software so they can soak the customers for upgrades later.
Whether software is easy to use, or never loses data, when the company
has a near monopoly, is almost irrelevant to profits, and therefore 
ignored. The manufacturer focuses on cheap gimicks like dancing paper 
clips to dazzle naive first-time buyers. The needs of existing 
experienced users are almost irrelevant. I see software rental as the 
best remedy.

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


Thread

Did the sort do anything? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-07 01:27 -0800
  Re: Did the sort do anything? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-07 02:20 -0800
    Re: Did the sort do anything? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-11-07 11:21 +0000
  Re: Did the sort do anything? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-11-07 10:49 +0000
    Re: Did the sort do anything? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-07 02:58 -0800
  Re: Did the sort do anything? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-07 07:11 -0500
    Re: Did the sort do anything? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-11-07 08:30 -0600
      Re: Did the sort do anything? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-07 21:03 -0500
  Re: Did the sort do anything? markspace <-@.> - 2011-11-07 07:48 -0800
  Re: Did the sort do anything? dagon@dagon.net (Dagon) - 2011-11-07 12:50 -0800
    Re: Did the sort do anything? Cindy <c.thurston@frell.okb.uwa.edu> - 2011-11-07 22:02 -0500
      Re: Did the sort do anything? Cindy <c.thurston@frell.okb.uwa.edu> - 2011-11-07 22:22 -0500
  Re: Did the sort do anything? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-07 17:42 -0500

csiph-web