Libraryless. Click here for Pure Java version (2505L/16K).
static <A> A second(L<A> l) { return get(l, 1); } static <A> A second(Iterable<A> l) { if (l == null) null; Iterator<A> it = iterator(l); if (!it.hasNext()) null; it.next(); ret it.hasNext() ? it.next() : null; } static <A> A second(A[] bla) { ret bla == null || bla.length <= 1 ? null : bla[1]; } ifclass Pair static <A, B> B second(Pair<A, B> p) { ret p == null ? null : p.b; } endif ifclass T3 static <A, B, C> B second(T3<A, B, C> t) { ret t == null ? null : t.b; } endif ifclass Producer static <A> A second(Producer<A> p) { if (p == null) null; if (p.next() == null) null; ret p.next(); } endif static char second(S s) { ret charAt(s, 1); } ifclass Either static <A, B> B second(Either<A, B> e) { ret e == null ? null : e.bOpt(); } endif
Began life as a copy of #1000628
download show line numbers debug dex old transpilations
Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1005162 |
Snippet name: | second function (get second element) |
Eternal ID of this version: | #1005162/10 |
Text MD5: | 6d9e8f71bc4b0ee79314bdabb8eacb2e |
Transpilation MD5: | 150550eafbfbd9b5fca7fe506fdf8ee3 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-05-23 17:16:58 |
Source code size: | 822 bytes / 45 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 726 / 903 |
Version history: | 9 change(s) |
Referenced in: | [show references] |