This seems like a strange thing to say.
There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
Why can't the order be guaranteed? What one gets when one ls
could, for example be a reasonable default.
Is this something that was decided for (performance?) reason, or perhaps where is some deeper truth out there?
As far as I know, there is no natural order that files gravitate toward. If you say alphabetic, then with which locale/collating sequence? Do all OSes that java runs on support that order intrinsically? If not, then the API would need to resort whatever was received from the OS. Since it is likely that you the API client 1) may not care or 2) will want something different, it makes much more sense to just deliver the files with no guaranteed order rather than doing a wasted sort. If you care, you can do the sort.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With