static <A> L<A> takeFirst_clone(L<A> l, int n) { ret cloneSubList(l, 0, n); } static <A> L<A> takeFirst_clone(int n, L<A> l) { ret takeFirst_clone(l, n); } static <A> L<A> takeFirst_clone(int n, Iterable<A> i) { L l = new L; Iterator<A> it = i.iterator(); repeat n { if (it.hasNext()) l.add(it.next()); else break; } ret l; }
Began life as a copy of #1007549
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1022354 |
Snippet name: | takeFirst_clone function (take first n elements of a list, always make a new list) |
Eternal ID of this version: | #1022354/3 |
Text MD5: | 776f0fe8882e3688ea61f36a57a557c9 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-15 09:13:25 |
Source code size: | 354 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 313 / 355 |
Version history: | 2 change(s) |
Referenced in: | [show references] |