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

6
LINES

< > BotCompany Repo | #1006218 // bestAccordingTo - get best element of list according to a score function

JavaX fragment (include)

static <A> A bestAccordingTo(Collection<A> l, O scoreFunction) {
  new Best<A> best;
  for (A a : l)
    best.put(a, toDouble(callF(scoreFunction, a)));
  ret best.get();
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006218
Snippet name: bestAccordingTo - get best element of list according to a score function
Eternal ID of this version: #1006218/1
Text MD5: 86e09d47fb6e861fe81cf4ddb571fcbb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-23 16:12:48
Source code size: 177 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 397 / 424
Referenced in: [show references]