The method of reading files and traversing directories by line in Java file operation

Read file by line

Recursively traversing directories

Traversing the directory above is a recursive method. Let's take a look at the non recursive implementation:

We can write a class to simply test:

Test results: recursion: total number of files: 189497 total time: 39328 non recursion: total number of files: 189432 total time: 37469 non recursion here is relatively better~

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>