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

22
LINES

< > BotCompany Repo | #1017753 // sortedByCalculatedField - synonym of sortByCalculatedField

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

Libraryless. Click here for Pure Java version (2599L/16K).

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

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: #1017753
Snippet name: sortedByCalculatedField - synonym of sortByCalculatedField
Eternal ID of this version: #1017753/8
Text MD5: 68767660c062a2f7810ffa7de964c78d
Transpilation MD5: dc83f31d1e23e8b1b727e429a4a9782c
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-04 08:49:47
Source code size: 601 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 536 / 682
Version history: 7 change(s)
Referenced in: [show references]