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

6
LINES

< > BotCompany Repo | #1028101 // putIfHigherByCalculatedField

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

Libraryless. Click here for Pure Java version (2494L/16K).

static <A, B> void lambdaMapLike putIfHigherByCalculatedField(IF1<B, ? extends Comparable> scorer, Map<A, B> map, A key, B value) {
  if (map == null || key == null || value == null) ret;
  B existing = map.get(key);
  if (existing == null || cmp(scorer.get(value), scorer.get(existing)) > 0)
    map.put(key, value);
}

Author comment

Began life as a copy of #1008400

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028101
Snippet name: putIfHigherByCalculatedField
Eternal ID of this version: #1028101/5
Text MD5: 056694a943b52cf5d118bf2e0360bb8e
Transpilation MD5: b0caeba3f2e1e7d0be8a4305fde48c5c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-19 14:07:47
Source code size: 324 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 207 / 331
Version history: 4 change(s)
Referenced in: [show references]