static <A> A collectionEntryAtIndex(Collection<A> l, int i) { if (l cast L) ret (A) get(l, i); if (i < 0 || i >= l(l)) null; Iterator<A> it = iterator(l); while (i-- > 0) if (!it.hasNext()) null; else it.next(); ret it.hasNext() ? it.next() : null; }
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: | #1021046 |
Snippet name: | collectionEntryAtIndex - scans if necessary |
Eternal ID of this version: | #1021046/2 |
Text MD5: | 7f0d20682889e2511e446850094aed36 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-01-19 18:00:09 |
Source code size: | 266 bytes / 7 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 249 / 285 |
Version history: | 1 change(s) |
Referenced in: | [show references] |