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

17
LINES

< > BotCompany Repo | #1010488 // oneOfTheFiles - return first one that exists

JavaX fragment (include)

static File oneOfTheFiles(S... paths) {
  if (paths != null) for (S path : paths)
    if (fileExists(path))
      ret newFile(path);
  null;
}

static File oneOfTheFiles(File... files) {
  ret oneOfTheFiles(asList(files));
}

static File oneOfTheFiles(Iterable<File> files) {
  if (files != null) for (File f : files)
    if (fileExists(f))
      ret f;
  null;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1010488
Snippet name: oneOfTheFiles - return first one that exists
Eternal ID of this version: #1010488/5
Text MD5: 1c5feeaa470af573196bc78b5703d4ad
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-10-14 14:05:41
Source code size: 379 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 497 / 553
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1013994 - firstFileThatExists - synonym of oneOfTheFiles - return first one that exists
#1016250 - firstCmdOnPATH_mandatory
#1029948 - oneOfTheFilesInDir - return first one that exists