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

22
LINES

< > BotCompany Repo | #1006868 // sortByCalculatedFieldDesc

JavaX fragment (include)

1  
// f: A -> Comparable
2  
static <A> L<A> sortByCalculatedFieldDesc(Collection<A> c, fO f) {
3  
  ret sortByCalculatedFieldDesc_inPlace(cloneList(c), f);
4  
}
5  
6  
static <A> L<A> sortByCalculatedFieldDesc(O f, Collection<A> c) {
7  
  ret sortByCalculatedFieldDesc(c, f);
8  
}
9  
10  
static <A, B> L<A> sortByCalculatedFieldDesc(Iterable<A> c, IF1<A, B> f) {
11  
  L<A> l = cloneList(c);
12  
  sort(l, new Comparator<A>() {
13  
    public int compare(A a, A b) {
14  
      ret stdcompare(f.get(b), f.get(a));
15  
    }
16  
  });
17  
  ret l;
18  
}
19  
20  
static <A, B> L<A> lambdaMapLike sortByCalculatedFieldDesc(IF1<A, B> f, Iterable<A> c) {
21  
  ret sortByCalculatedFieldDesc(c, f);
22  
}

Author comment

Began life as a copy of #1006712

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006868
Snippet name: sortByCalculatedFieldDesc
Eternal ID of this version: #1006868/7
Text MD5: a6e86bb1243b75b637572ce2f0e529a0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-18 11:55:12
Source code size: 641 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 541 / 629
Version history: 6 change(s)
Referenced in: [show references]