1 | static <A> A mapMethodLike highestByField(S field, Collection<A> l) {
|
2 | A best = null; |
3 | O bestValue = null; |
4 | if (l != null) for(A a : l) {
|
5 | O val = getOpt(a, field); |
6 | if (val != null && (bestValue == null || cmp(val, bestValue) > 0)) {
|
7 | best = a; |
8 | bestValue = val; |
9 | } |
10 | } |
11 | ret best; |
12 | } |
13 | |
14 | static <A> A highestByField(Collection<A> l, S field) {
|
15 | ret highestByField(field, l); |
16 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1011185 |
| Snippet name: | highestByField - ignores elements where field = null |
| Eternal ID of this version: | #1011185/5 |
| Text MD5: | 5fceb15e4c80ebec3229f5c4fc612028 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-03-06 08:03:21 |
| Source code size: | 412 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 740 / 748 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |