Libraryless. Click here for Pure Java version (5187L/29K).
static <A, B extends Number> A lowest(Map<A, B> map) { A best = null; Number bestScore = null; for (A key : keys(map)) { Number score = map.get(key); if (best == null || cmp(score, bestScore) < 0) { best = key; bestScore = score; } } ret best; } static <A> A lowest(Iterable<A> l, IF1<A, Number> f) { ret lowestByScoreFunction(l, f); }
Began life as a copy of #1002040
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003134 |
Snippet name: | lowest - get key with lowest value. also lowestByScoreFunction |
Eternal ID of this version: | #1003134/3 |
Text MD5: | dd977d6f1ced1970c5a1846b335acc2a |
Transpilation MD5: | 5f5b0f5ced6177aa38cb91bc87cb1b83 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-29 10:27:16 |
Source code size: | 387 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 671 / 723 |
Version history: | 2 change(s) |
Referenced in: | [show references] |