Libraryless. Click here for Pure Java version (2557L/16K).
static <A> ItIt<A> cyclicListIterator(L<A> l) { if (empty(l)) ret emptyItIt(); ret new ItIt<A> { int i; public bool hasNext() { true; } public A next() { A a = l.get(i); if (++i >= l(l)) i = 0; ret a; } }; }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030127 |
Snippet name: | cyclicListIterator |
Eternal ID of this version: | #1030127/1 |
Text MD5: | cfb1a07f4c9be04de902898535428ab3 |
Transpilation MD5: | f8a9e50abcf58376c3acff4f26c40d12 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-11-10 12:17:25 |
Source code size: | 258 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 278 / 367 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1030683 - takeFirstOfCyclicList |