Libraryless. Click here for Pure Java version (2212L/14K).
1 | // f: A -> Comparable |
2 | static <A> L<A> sortInPlaceByCalculatedField(L<A> l, final F1<A, ?> f) { |
3 | sort(l, new Comparator<A>() { |
4 | public int compare(A a, A b) { |
5 | ret stdcompare(f.get(a), f.get(b)); |
6 | } |
7 | }); |
8 | ret l; |
9 | } |
10 | |
11 | static <A> L<A> sortInPlaceByCalculatedField(L<A> l, final IF1<A, ?> f) { |
12 | sort(l, new Comparator<A>() { |
13 | public int compare(A a, A b) { |
14 | ret stdcompare(f.get(a), f.get(b)); |
15 | } |
16 | }); |
17 | ret l; |
18 | } |
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: | 408 / 511 |
Version history: | 2 change(s) |
Referenced in: | [show references] |