脚本宝典收集整理的这篇文章主要介绍了Java尾递归文件夹遍历,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
public void Traverse(File dir) throws IOException { if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; children != null && i < children.length; i++) { Traverse(new File(dir, children[i])); } } if (dir.isFile()) { // do whatever you want } }
参考资料:
[1]什么是尾递归?http://en.wikipedia.org/wiki/Tail_recursion
以上是脚本宝典为你收集整理的Java尾递归文件夹遍历全部内容,希望文章能够帮你解决Java尾递归文件夹遍历所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。