static <A> CloseableIterableIterator<A> iteratorFromFunction_withEndMarker_f0_autoCloseable(final F0<A> f, final AutoCloseable closeable) { class IFF2 extends CloseableIterableIterator<A> { A a; bool done; public bool hasNext() { getNext(); ret !done; } public A next() { getNext(); if (done) fail(); A _a = a; a = null; ret _a; } void getNext() { if (done || a != null) ret; a = f.get(); done = a == endMarker(); } public void close() tex { if (closeable != null) closeable.close(); } }; ret new IFF2; }
Began life as a copy of #1017244
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020979 |
Snippet name: | iteratorFromFunction_withEndMarker_f0_autoCloseable |
Eternal ID of this version: | #1020979/1 |
Text MD5: | edbb3c6196055c7aa462a1c44cf71d38 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-01-15 16:53:50 |
Source code size: | 665 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 343 / 341 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |