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

10
LINES

< > BotCompany Repo | #1006712 // sortByCalculatedField

JavaX fragment (include)

// f: A -> Comparable
static <A> L<A> sortByCalculatedField(Iterable<A> c, final O f) {
  L<A> l = cloneList(c);
  sort(l, new Comparator<A>() {
    public int compare(A a, A b) {
      ret stdcompare(callF(f, a), callF(f, b));
    }
  });
  ret l;
}

Author comment

Began life as a copy of #1006223

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006712
Snippet name: sortByCalculatedField
Eternal ID of this version: #1006712/4
Text MD5: 550090d8e92ba94ab736939f8f077dfc
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-02 19:44:42
Source code size: 259 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 588 / 611
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1006868 - sortByCalculatedFieldDesc
#1011720 - sortByCalculatedField_f1 - faster
#1011721 - sortBySecondOfPairs_inPlace
#1016503 - sortByCalculatedFieldIC
#1021847 - sortByMapKey