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)

static <A> L<A> sortedDescAccordingTo(Collection<A> c, final O scoreF) {
  L<A> l = cloneList(c);
  sort(l, new Comparator<A>() {
    public int compare(A a, A b) {
      ret stdcompare(toDouble(callF(scoreF, b)), toDouble(callF(scoreF, a)));
    }
  });
  ret l;
}

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