Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1002040 // keyWithBiggestValue

JavaX fragment (include)

static <A, B extends Number> A keyWithBiggestValue(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;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1002040
Snippet name: keyWithBiggestValue
Eternal ID of this version: #1002040/1
Text MD5: 51cc1f6da6ff41db2d8e057996181699
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-15 00:16:12
Source code size: 303 bytes / 12 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 544 / 1528
Referenced in: [show references]