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)

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

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: 462 / 494
Referenced in: [show references]