Libraryless. Click here for Pure Java version (2152L/14K).
1 | static <A> Set<A> set_moveFirst(Iterable<A> items, Set<A> set) { |
2 | new LinkedHashSet<A> out; |
3 | Set<A> remaining = cloneSet(set); |
4 | for (A a : items) |
5 | if (remaining.remove(a)) |
6 | out.add(a); |
7 | out.addAll(remaining); |
8 | ret out; |
9 | } |
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1026013 |
Snippet name: | set_moveFirst - move elements to beginning of set |
Eternal ID of this version: | #1026013/2 |
Text MD5: | 8423d2fb87d6b8016efcbdf9cd2807eb |
Transpilation MD5: | 2642e391e6119516b4c353997fbf3605 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-11-07 14:07:08 |
Source code size: | 241 bytes / 9 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 179 / 272 |
Version history: | 1 change(s) |
Referenced in: | [show references] |