// iterate safely (& quickly) in the face of concurrent modifications static <A> IterableIterator<A> concurrentlyIterateList(final L<A> l) { ret iteratorFromFunction_withEndMarker_f0(new F0<A>() { int i; A get() { int _i = i++; synchronized(l) { if (_i < l(l)) { A a = l.get(_i); if (a == iteratorFromFunction_endMarker) fail("no"); // ugly comparison fail-fast redemption ret a; } ret (A) iteratorFromFunction_endMarker; // ugly cast } } }); }
Began life as a copy of #1012173
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1012178 |
Snippet name: | concurrentlyIterateList - wants a RandomAccessList |
Eternal ID of this version: | #1012178/8 |
Text MD5: | e895be85f5c85485dfd280f84badf55b |
Author: | stefan |
Category: | javax / collections |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-07-11 13:20:21 |
Source code size: | 550 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 453 / 497 |
Version history: | 7 change(s) |
Referenced in: | [show references] |