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

11
LINES

< > BotCompany Repo | #1016422 // combineAutoCloseables - closes a first, then b

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

Libraryless. Click here for Pure Java version (2894L/17K).

static AutoCloseable combineAutoCloseables(final AutoCloseable a, final AutoCloseable b) {
  ret a == null ? b : b == null ? a : autocloseable { pClose(a); pClose(b); };
}

static AutoCloseable combineAutoCloseables(AutoCloseable a, AutoCloseable b, AutoCloseable c, AutoCloseable... more) {
  ret combineAutoCloseables(concatLists(ll(a, b, c), asList(more)));
}

static AutoCloseable combineAutoCloseables(Iterable<AutoCloseable> l) {
  ret foldl(func(AutoCloseable a, AutoCloseable b) -> AutoCloseable { combineAutoCloseables(a,b) }, null, l);
}

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: #1016422
Snippet name: combineAutoCloseables - closes a first, then b
Eternal ID of this version: #1016422/8
Text MD5: c6816be79a2ed5ea57acf0598de6cf8d
Transpilation MD5: 8cbb2565368e24cca6893680d8f0db45
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-24 22:36:44
Source code size: 557 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 615 / 734
Version history: 7 change(s)
Referenced in: [show references]