Libraryless. Click here for Pure Java version (2543L/16K).
1 | static <A, B, C> LinkedHashMap<A, B> mapSortedByFunctionOnValue(Map<A, B> map, IF1<B, C> f) { |
2 | L<A> l = new ArrayList(map.keySet()); |
3 | sort(l, (a, b) -> cmp(f.get(map.get(a)), f.get(map.get(b)))); |
4 | new LinkedHashMap<A, B> map2; |
5 | for (A a : l) |
6 | map2.put(a, map.get(a)); |
7 | ret map2; |
8 | } |
Began life as a copy of #1007624
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1029622 |
Snippet name: | mapSortedByFunctionOnValue |
Eternal ID of this version: | #1029622/4 |
Text MD5: | 7bcb3ee9c43ff81b20fbe079aceda1c6 |
Transpilation MD5: | 4096df6eb421a1e95f8a618ce29fa68d |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-08-30 16:05:42 |
Source code size: | 295 bytes / 8 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 190 / 276 |
Version history: | 3 change(s) |
Referenced in: | [show references] |