import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; import java.util.stream.Collectors; public class Main { public static void main(String[] argv) throws Exception { Path path = Paths.get("E:\\Java_Dev"); List<Path> files = Files.walk( path ) .filter( Files::isReadable ) .filter( Files::isRegularFile ) .limit(10) .collect(Collectors.toList()); System.out.println(files); } }