Libraryless. Click here for Pure Java version (2578L/16K).
1 | static <A> Set<A> putSetElementsFirst(Cl<A> cl, Cl<A> elements) { |
2 | Set<A> inputSet = asSet(cl); |
3 | new LinkedHashSet<A> set; |
4 | fOr (A a : elements) |
5 | if (contains(inputSet, a)) |
6 | set.add(a); |
7 | addAll(set, cl); // keep order |
8 | ret set; |
9 | } |
10 | |
11 | static <A> Set<A> putSetElementsFirst(Cl<A> cl, A... elements) { |
12 | ret putSetElementsFirst(cl, asList(elements)); |
13 | } |
Began life as a copy of #1004134
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: | #1029791 |
Snippet name: | putSetElementsFirst - convert collection to LinkedHashSet with specified keys in front |
Eternal ID of this version: | #1029791/3 |
Text MD5: | 8941b14794f09581b6e7d280405ac8f6 |
Transpilation MD5: | 468292a0fab9343520e7cb58f0b3a9b5 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-09-17 12:07:38 |
Source code size: | 371 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 205 / 294 |
Version history: | 2 change(s) |
Referenced in: | [show references] |