Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1004656 // class Highest - collect object with highest value in something

JavaX fragment (include)

static class Highest<A> {
  A a;
  double score;
  
  bool update(A x, double s) {
    if (a == null || s > score) {
      a = x;
      score = s;
      true;
    }
    false;
  }
  
  Pair<A, Double> getPair() {
    ret a == null ? null : pair(a, score);
  }
}

Author comment

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: 542 / 1120
Referenced in: [show references]