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)

1  
static File oneOfTheFiles(S... paths) {
2  
  if (paths != null) for (S path : paths)
3  
    if (fileExists(path))
4  
      ret newFile(path);
5  
  null;
6  
}
7  
8  
static File oneOfTheFiles(File... files) {
9  
  ret oneOfTheFiles(asList(files));
10  
}
11  
12  
static File oneOfTheFiles(Iterable<File> files) {
13  
  if (files != null) for (File f : files)
14  
    if (fileExists(f))
15  
      ret f;
16  
  null;
17  
}

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: 496 / 552
Version history: 4 change(s)
Referenced in: [show references]