Libraryless. Click here for Pure Java version (1619L/11K).
static <A> A mapMethodLike switchIfShorterInField(S field, A newOne, A oldOne) { ret switchIfShorterInField(field, newOne, oldOne, null); } static <A> A mapMethodLike switchIfShorterInField(S field, A newOne, A oldOne, Runnable onSwitch) { ret oldOne == null ? with(onSwitch, newOne) : newOne == null ? oldOne : cmp(l(getOpt(newOne, field)), l(getOpt(oldOne, field))) < 0 ? with(onSwitch, newOne) : oldOne; }
Began life as a copy of #1024017
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1024019 |
| Snippet name: | switchIfShorterInField |
| Eternal ID of this version: | #1024019/3 |
| Text MD5: | 9e595eae9cd3ab15f64129e38d7cea55 |
| Transpilation MD5: | b88ec0b7429451b8655f0ac58e7d335a |
| Author: | stefan |
| Category: | javax / optimization |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-07-16 00:47:07 |
| Source code size: | 429 bytes / 9 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 494 / 635 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |