1 | static class Highest<A> { |
2 | A a; |
3 | double score; |
4 | |
5 | bool update(A x, double s) { |
6 | if (a == null || s > score) { |
7 | a = x; |
8 | score = s; |
9 | true; |
10 | } |
11 | false; |
12 | } |
13 | |
14 | Pair<A, Double> getPair() { |
15 | ret a == null ? null : pair(a, score); |
16 | } |
17 | } |
Began life as a copy of #1004653
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004656 |
Snippet name: | class Highest - collect object with highest value in something |
Eternal ID of this version: | #1004656/1 |
Text MD5: | b1d0e6d7b7f0edddfe18fbced1b2c1dd |
Author: | stefan |
Category: | javax / images |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-25 13:34:34 |
Source code size: | 279 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 544 / 1123 |
Referenced in: | [show references] |