Libraryless. Click here for Pure Java version (2746L/16K).
static <A> L<A> moveItemFirst(A item, Cl<A> l) { if (!contains(l, item)) ret asList(l); L<A> out = emptyList(l(l)); out.add(item); for (A a : l) if (!eq(a, item)) out.add(a); ret out; }
Began life as a copy of #1026013
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030795 |
Snippet name: | moveItemFirst - move element to beginning of (cloned) list |
Eternal ID of this version: | #1030795/3 |
Text MD5: | 63b630a85fbf2e8288217bc6c5d083cf |
Transpilation MD5: | 3e78e4c4a026b9ce9803831257b4b6d9 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-03-26 15:17:48 |
Source code size: | 213 bytes / 9 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 177 / 274 |
Version history: | 2 change(s) |
Referenced in: | [show references] |