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

12
LINES

< > BotCompany Repo | #1032510 // bestOfN_stopAtScore

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4426L/25K).

static <A> Scored<A> lambdaMapLike bestOfN_stopAtScore(IF1<A, Double> scoreFunction, double stopScore, int nMax, IF0<A> produce) {
  new Best<A> best;
  
  repeat nMax {
    A a = produce!;
    double score = scoreFunction.get(a);
    best.put(a, score);
    if (score >= stopScore) break;
  }
  
  ret best.scored();
}

Author comment

Began life as a copy of #1032499

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032510
Snippet name: bestOfN_stopAtScore
Eternal ID of this version: #1032510/1
Text MD5: 0ba4d6c89f65f65f4cd33ea57eb07bf5
Transpilation MD5: 400f20917777659fcefeadd65c5f9252
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-12 09:56:11
Source code size: 330 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 76 / 115
Referenced in: [show references]