static Int distanceOfClosestIntTo(int value, L<Int> l) { int lowest = -1; for (int x : l) { int diff = absDiff(value, x); if (lowest < 0 || diff < lowest) lowest = diff; } ret lowest < 0 ? null : lowest; }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018792 |
Snippet name: | distanceOfClosestIntTo |
Eternal ID of this version: | #1018792/2 |
Text MD5: | 9df591119cccb50701551d0692151525 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-13 18:56:43 |
Source code size: | 228 bytes / 8 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 320 / 353 |
Version history: | 1 change(s) |
Referenced in: | [show references] |