Libraryless. Click here for Pure Java version (9185L/51K).
1 | static <A extends AutoCloseable, B> L<B> mapCloseables_pcall(Iterable<A> l, IF1<A, B> f) { |
2 | L x = emptyList(l); |
3 | if (l != null) for (A o : l) try { |
4 | pcall { |
5 | x.add(f.get(o)); |
6 | } |
7 | } finally { |
8 | _close(o); |
9 | } |
10 | ret x; |
11 | } |
12 | |
13 | static <A extends AutoCloseable, B> L<B> lambdaMapLike mapCloseables_pcall(IF1<A, B> f, Iterable<A> l) { |
14 | ret mapCloseables_pcall(l, f); |
15 | } |
Began life as a copy of #1010000
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035985 |
Snippet name: | mapCloseables_pcall - map() with safe calling (skip elements when failed) and closing each input item |
Eternal ID of this version: | #1035985/3 |
Text MD5: | f3255b57d0ab8fe73c38a244a97c433f |
Transpilation MD5: | 71bb32d5f097afadec118b2223fda0c7 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-21 02:40:17 |
Source code size: | 389 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 160 / 210 |
Version history: | 2 change(s) |
Referenced in: | [show references] |