Libraryless. Click here for Pure Java version (3140L/17K).
1 | static <A, B> L<A> lambdaMapLike sortedBy(IF1<A, B> f, Iterable<A> c) { |
2 | ret sortedBy(c, f); |
3 | } |
4 | |
5 | static <A, B> L<A> sortedBy(Iterable<A> c, IF1<A, B> f) { |
6 | L<A> l = cloneList(c); |
7 | sort(l, new Comparator<A>() { |
8 | public int compare(A a, A b) { |
9 | ret stdcompare(f.get(a), f.get(b)); |
10 | } |
11 | }); |
12 | ret l; |
13 | } |
Began life as a copy of #1017753
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1032236 |
Snippet name: | sortedBy - synonym of sortByCalculatedField |
Eternal ID of this version: | #1032236/1 |
Text MD5: | b78a1ce5b1827ba3a6a09d89805c6631 |
Transpilation MD5: | 6be7460fbbade636d840c269d8321266 |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-08-21 02:18:34 |
Source code size: | 323 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 156 / 233 |
Referenced in: | [show references] |