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

9
LINES

< > BotCompany Repo | #1006223 // sortedDescAccordingTo - takes a Collection<A> and a score function (A) -> int

JavaX fragment (include)

1  
static <A> L<A> sortedDescAccordingTo(Collection<A> c, final O scoreF) {
2  
  L<A> l = cloneList(c);
3  
  sort(l, new Comparator<A>() {
4  
    public int compare(A a, A b) {
5  
      ret stdcompare(toDouble(callF(scoreF, b)), toDouble(callF(scoreF, a)));
6  
    }
7  
  });
8  
  ret l;
9  
}

Author comment

Began life as a copy of #1006221

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: #1006223
Snippet name: sortedDescAccordingTo - takes a Collection<A> and a score function (A) -> int
Eternal ID of this version: #1006223/1
Text MD5: 54473b2391660df5ca5d33437b5c6dda
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:45:31
Source code size: 273 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 502 / 542
Referenced in: [show references]