Forums Register Login

Arrays Sorting

+Pie Number of slices to send: Send


If a comparator is not used for sorting, the answer is done,aone,bone,cone.??? What is happening. Shouldnt it sort by its natural order?
+Pie Number of slices to send: Send
It is being sorted according to java.lang.String's natural order. Look carefully at the String " done".
What's that whitespace doing there? What do you suppose the lexicographical order of that character is?
+Pie Number of slices to send: Send
see it is not "done", it is " done" mean space than done.
+Pie Number of slices to send: Send
Ok.thanks.
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 749 times.
Similar Threads
Doubt in Collections
Comparator interface
Comparator interface
Object of static class
sorting array
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:17:05.