1 | static <A> CloseableIterableIterator<A> iteratorFromFunction_f0_autoCloseable(final F0<A> f, final AutoCloseable closeable) {
|
2 | class IFF2 extends CloseableIterableIterator<A> {
|
3 | A a; |
4 | bool done; |
5 | |
6 | public bool hasNext() {
|
7 | getNext(); |
8 | ret !done; |
9 | } |
10 | |
11 | public A next() {
|
12 | getNext(); |
13 | if (done) fail(); |
14 | A _a = a; |
15 | a = null; |
16 | ret _a; |
17 | } |
18 | |
19 | void getNext() {
|
20 | if (done || a != null) ret; |
21 | a = f.get(); |
22 | done = a == null; |
23 | } |
24 | |
25 | public void close() tex {
|
26 | if (closeable != null) closeable.close(); |
27 | } |
28 | }; |
29 | ret new IFF2; |
30 | } |
Began life as a copy of #1012440
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: | #1017244 |
| Snippet name: | iteratorFromFunction_f0_autoCloseable - end on null |
| Eternal ID of this version: | #1017244/6 |
| Text MD5: | fb0ea970a52db958ca27009573890cb1 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-08-19 17:48:12 |
| Source code size: | 644 bytes / 30 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 660 / 696 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |