Libraryless. Click here for Pure Java version (2543L/16K).
static <A, B, C> LinkedHashMap<A, B> mapSortedByFunctionOnValue(Map<A, B> map, IF1<B, C> f) { L<A> l = new ArrayList(map.keySet()); sort(l, (a, b) -> cmp(f.get(map.get(a)), f.get(map.get(b)))); new LinkedHashMap<A, B> map2; for (A a : l) map2.put(a, map.get(a)); ret map2; }
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: | 189 / 274 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1031033 - mapSortedByFunctionOnKey |