Libraryless. Click here for Pure Java version (4583L/27K).
1 | transient new CloseablesHolder resources; |
2 | |
3 | <A extends AutoCloseable> A ownResource(A resource) { resources?.add(resource); ret resource; } |
4 | |
5 | void ownResources(IResourceHolder holder) { |
6 | assertNotNull(resources); |
7 | if (holder == null) ret; |
8 | resources.addAll(holder.takeAll()); |
9 | } |
10 | |
11 | close { resources?.close(); } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033023 |
Snippet name: | Resources mix-in |
Eternal ID of this version: | #1033023/5 |
Text MD5: | a950447a546e1c36a1bd3c899496466b |
Transpilation MD5: | 10ce2dfbf9e86766eeedbff4271ec707 |
Author: | stefan |
Category: | javax / opus |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-11 12:21:49 |
Source code size: | 319 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 157 / 392 |
Version history: | 4 change(s) |
Referenced in: | [show references] |