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

18
LINES

< > BotCompany Repo | #1017401 // sortInPlaceByCalculatedField

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

Libraryless. Click here for Pure Java version (2212L/14K).

// f: A -> Comparable
static <A> L<A> sortInPlaceByCalculatedField(L<A> l, final F1<A, ?> f) {
  sort(l, new Comparator<A>() {
    public int compare(A a, A b) {
      ret stdcompare(f.get(a), f.get(b));
    }
  });
  ret l;
}

static <A> L<A> sortInPlaceByCalculatedField(L<A> l, final IF1<A, ?> f) {
  sort(l, new Comparator<A>() {
    public int compare(A a, A b) {
      ret stdcompare(f.get(a), f.get(b));
    }
  });
  ret l;
}

Author comment

Began life as a copy of #1013485

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: #1017401
Snippet name: sortInPlaceByCalculatedField
Eternal ID of this version: #1017401/3
Text MD5: 125649c2e90f3c2139bb7cd33e244c27
Transpilation MD5: 1d6c519425cd5a5443024d2ddbe3121b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-27 21:28:29
Source code size: 450 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 407 / 509
Version history: 2 change(s)
Referenced in: [show references]