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

18
LINES

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

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

Libraryless. Click here for Pure Java version (1937L/12K).

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

static <A> L<A> mapLike sortedByCalculatedField(O 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   

Travelled to 10 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1017753
Snippet name: sortedByCalculatedField - synonym of sortByCalculatedField
Eternal ID of this version: #1017753/6
Text MD5: 1f3aca6688511b2b078469d30b5df80f
Transpilation MD5: fcbd480118528c4c41e522e733f7b823
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-13 17:09:05
Source code size: 478 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 163 / 168
Version history: 5 change(s)
Referenced in: [show references]