Best way to list files in Java, sorted by Date Modified?

后端 未结 17 1169
-上瘾入骨i
-上瘾入骨i 2020-11-22 11:51

I want to get a list of files in a directory, but I want to sort it such that the oldest files are first. My solution was to call File.listFiles and just resort the list ba

17条回答
  •  梦谈多话
    2020-11-22 12:42

    You might also look at apache commons IO, it has a built in last modified comparator and many other nice utilities for working with files.

提交回复
热议问题