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

22
LINES

< > BotCompany Repo | #1006868 // sortByCalculatedFieldDesc

JavaX fragment (include)

// f: A -> Comparable
static <A> L<A> sortByCalculatedFieldDesc(Collection<A> c, fO f) {
  ret sortByCalculatedFieldDesc_inPlace(cloneList(c), f);
}

static <A> L<A> sortByCalculatedFieldDesc(O f, Collection<A> c) {
  ret sortByCalculatedFieldDesc(c, f);
}

static <A, B> L<A> sortByCalculatedFieldDesc(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(b), f.get(a));
    }
  });
  ret l;
}

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

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: 535 / 620
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1008289 - sortByFieldLengthDesc
#1018326 - sortByCalculatedFieldDesc_inPlace
#1019008 - sortByMethodDesc