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

10
LINES

< > BotCompany Repo | #1006791 // lowestAccordingTo - get lowest element of list according to a score function

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3027L/18K).

static <A> A lowestAccordingTo(Collection<A> l, IF1<A, Double> scoreFunction) {
  ret lowestAccordingTo(l, (O) scoreFunction);
}

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

Author comment

Began life as a copy of #1006218

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: #1006791
Snippet name: lowestAccordingTo - get lowest element of list according to a score function
Eternal ID of this version: #1006791/2
Text MD5: 5c6cde98482efbd8c56b66d6c35fdf0c
Transpilation MD5: 745255723a1d6bfc0c93e6f93fcf6839
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-07 15:15:55
Source code size: 321 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 446 / 522
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)