Libraryless. Click here for Pure Java version (2722L/16K).
static <A> A getFromIterator(Iterator<A> it, int idx) { if (idx < 0) null; while ping (true) { if (!it.hasNext()) null; else { A a = it.next(); if (idx-- == 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: | #1031095 |
Snippet name: | getFromIterator |
Eternal ID of this version: | #1031095/1 |
Text MD5: | c9a3c115d5ea1ecf3e8a80f2a143484a |
Transpilation MD5: | 463af550bc55981a259dc5bab5ee294b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-05-01 15:29:08 |
Source code size: | 227 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 144 / 210 |
Referenced in: | [show references] |