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

12
LINES

< > BotCompany Repo | #1011867 // smallestByMethod

JavaX fragment (include)

static <A> A smallestByMethod(Collection<A> l, S method, O... args) {
  A best = null;
  O bestValue = null;
  if (l != null) for(A a : l) {
    O val = callOpt(a, method, args);
    if (val != null && (bestValue == null || cmp(val, bestValue) < 0)) {
      best = a;
      bestValue = val;
    }
  }
  ret best;
}

Author comment

Began life as a copy of #1011185

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1011867
Snippet name: smallestByMethod
Eternal ID of this version: #1011867/1
Text MD5: 916ad0be0f8b6e314760314720e04877
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-08 06:23:37
Source code size: 325 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 293 / 375
Referenced in: [show references]