Maybe this has been answered before, but I was not able to find it. Basicly this is the problem. I have a list of image files in a directory. They are numbered from 1-n where n -s greater than 10. In my program I create a file object pointing to the directory the files are in, and then call “listFiles()” on the file object. It returns the files, but in the following order:
filename1.jpg filename10.jpg filename11.jpg ... filename2.jpg filename20.jpg filename21.jpg ...
Is this the OS reporting the file like this? How Do I stop it from doing this?
The documentation clearly states
So you should simply not rely on this. You could sort them if you want to get always the same order, using:
or