We would like to know how to list file under a folder then sort.
/*from w ww. j av a 2 s. co m*/ import java.nio.file.Files; import java.nio.file.Paths; public class Main { public static void main(String[] args) throws Exception{ Files .list(Paths.get("c:/Java_Dev")) .sorted() .forEach(System.out::println); } }
The code above generates the following result.