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).

static L<File> findAllFiles_noDirs_pred(File dir, O pred) {
  new L<File> l;
  if (isTrue_callF(pred, dir))
    findAllFiles_noDirs_pred_impl(dir, pred, l);
  ret l;
}

svoid findAllFiles_noDirs_pred_impl(File dir, O pred, L<File> l) {
  for (File f : listFiles(dir)) {
    if (!isTrue_callF(pred, f)) continue;
    if (f.isDirectory())
      findAllFiles_noDirs_pred_impl(f, pred, l);
    else
      l.add(f);
  }
}

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: 222 / 322
Version history: 2 change(s)
Referenced in: [show references]