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).

// f: A -> Comparable
static <A> L<A> sortedByCalculatedField(Iterable<A> c, O f) {
  ret sortByCalculatedField(c, f);
}

static <A> L<A> sortedByCalculatedField(O f, Iterable<A> c) {
  ret sortedByCalculatedField(c, f);
}

static <A, B> L<A> lambdaMapLike sortedByCalculatedField(IF1<A, B> f, Iterable<A> c) {
  ret sortedByCalculatedField(c, f);
}

static <A, B> L<A> sortedByCalculatedField(Iterable<A> c, IF1<A, B> f) {
  L<A> l = cloneList(c);
  sort(l, new Comparator<A>() {
    public int compare(A a, A b) {
      ret stdcompare(f.get(a), f.get(b));
    }
  });
  ret l;
}

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: 534 / 678
Version history: 7 change(s)
Referenced in: [show references]