Traversing directories without using recursion?

后端 未结 8 2107
无人及你
无人及你 2021-01-18 06:46

The Problem I need to write a simple software that, giving certain constraints, appends to a list a series of files. The user could choose between

8条回答
  •  灰色年华
    2021-01-18 07:14

    Based on PATRY Guillaume solution

    public static List getFolderTree(File node)
      {
        List directories = new ArrayList();
        if (node.isDirectory())
        {
          directories.add(node);
        }
    
        for(int i=0; i

提交回复
热议问题