Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1024399 // findAllFiles_noDirs_pred (scans recursively, returns files only)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (1653L/11K).

1  
static L<File> findAllFiles_noDirs_pred(File dir, O pred) {
2  
  new L<File> l;
3  
  if (isTrue_callF(pred, dir))
4  
    findAllFiles_noDirs_pred_impl(dir, pred, l);
5  
  ret l;
6  
}
7  
8  
svoid findAllFiles_noDirs_pred_impl(File dir, O pred, L<File> l) {
9  
  for (File f : listFiles(dir)) {
10  
    if (!isTrue_callF(pred, f)) continue;
11  
    if (f.isDirectory())
12  
      findAllFiles_noDirs_pred_impl(f, pred, l);
13  
    else
14  
      l.add(f);
15  
  }
16  
}

Author comment

Began life as a copy of #1003844

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024399
Snippet name: findAllFiles_noDirs_pred (scans recursively, returns files only)
Eternal ID of this version: #1024399/3
Text MD5: 896ae2c49d03e797215cedc10cf39c11
Transpilation MD5: cffe504ff6e3c82c85da08a5c7ececc6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-09 23:48:27
Source code size: 433 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 223 / 325
Version history: 2 change(s)
Referenced in: [show references]