static <A> A third(L<A> l) { return _get(l, 2); } static <A> A third(Iterable<A> l) { if (l == null) null; Iterator<A> it = iterator(l); repeat 2 { if (!it.hasNext()) null; it.next(); } ret it.hasNext() ? it.next() : null; } ifclass Producer static <A> A third(Producer<A> p) { if (p == null) null; repeat 2 { if (p.next() == null) null; } ret p.next(); } endif static <A> A third(A[] bla) { ret bla == null || bla.length <= 2 ? null : bla[2]; } ifclass T3 static <A, B, C> C third(T3<A, B, C> t) { ret t == null ? null : t.c; } endif
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006330 |
Snippet name: | third - get third element from a list |
Eternal ID of this version: | #1006330/6 |
Text MD5: | 968646c1e365ac398be34bbcce76b550 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-31 19:15:54 |
Source code size: | 606 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 668 / 707 |
Version history: | 5 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1030502 - fourth - get fourth element from a list |