Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #33427
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2015-12-29 05:41 -0800 |
| References | <ab12b5b7-eab1-4f4a-93c1-3c386d64a7f3@googlegroups.com> <sort-20151228215836@ram.dialup.fu-berlin.de> <slrnn83gsr.456.avl@login.logic.tuwien.ac.at> |
| Message-ID | <488c1a31-e844-436a-972c-5861022e8619@googlegroups.com> (permalink) |
| Subject | Re: Java sort |
| From | Eric Douglas <e.d.programmer@gmail.com> |
On Monday, December 28, 2015 at 6:20:04 PM UTC-5, Andreas Leitgeb wrote: > > This might actually be a little bit off-topic here, > > but I just tried this in Windows explorer: I created > > four files and had Windows explorer sort them by name. > > The outcome: > > 4 > > 33333333333333333 > > 11111111111111111111111111111111111111111111111111111111111111111111111111111 > > 22222222222222222222222222222222222222 > > It is not obvious by which meaning of the word »sorted« > > this is now »sorted«. > > I don't know what is the algorithm used, but I can think of some > algorithm that would yield that order: > > Namely, if it only uses as many digits as fit into a long (64bit) > > Rename the 3333... file to append 2 more "3"s, and I'd predict it'll > get sorted to bottom (after a refresh). I don't have Windows here, so > can't test myself. Correct. That file named 4 gets sorted between a file named 1-20 and a file named 10-20 which all come before the file with the 1s. That file with the 3s does sort after that file with the 2s if you add 2 more 3s. In that particular case perhaps the simple DOS (Command Prompt) alpha sort makes more sense? It now seems likely neither method would give the results a human would, so perhaps I should use a hybrid sort that is not quite what Windows Explorer would do but still much better than the DOS command. Command Prompt sorting, using Collections.sort(), gets annoying when 96.pdf comes between 959.pdf and 960.pdf.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Java sort Eric Douglas <e.d.programmer@gmail.com> - 2015-12-28 12:08 -0800
Re: Java sort Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-28 15:35 -0500
Re: Java sort Eric Douglas <e.d.programmer@gmail.com> - 2015-12-28 12:49 -0800
Re: Java sort Eric Douglas <e.d.programmer@gmail.com> - 2015-12-28 13:02 -0800
Re: Java sort Eric Douglas <e.d.programmer@gmail.com> - 2015-12-28 13:16 -0800
Re: Java sort Arne Vajhøj <arne@vajhoej.dk> - 2015-12-28 22:49 -0500
Re: Java sort Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-28 17:55 -0500
Re: Java sort leif.roar@dimnakorr.com - 2015-12-29 01:20 -0600
Re: Java sort Andreas Leitgeb <avl@logic.at> - 2015-12-28 23:17 +0000
Re: Java sort Eric Douglas <e.d.programmer@gmail.com> - 2015-12-29 05:41 -0800
Re: Java sort Arne Vajhøj <arne@vajhoej.dk> - 2015-12-28 22:47 -0500
Re: Java sort Jeff Higgins <jeff@invalid.invalid> - 2015-12-29 15:03 +0000
csiph-web