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

12
LINES

< > BotCompany Repo | #1011867 // smallestByMethod

JavaX fragment (include)

1  
static <A> A smallestByMethod(Collection<A> l, S method, O... args) {
2  
  A best = null;
3  
  O bestValue = null;
4  
  if (l != null) for(A a : l) {
5  
    O val = callOpt(a, method, args);
6  
    if (val != null && (bestValue == null || cmp(val, bestValue) < 0)) {
7  
      best = a;
8  
      bestValue = val;
9  
    }
10  
  }
11  
  ret best;
12  
}

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