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

12
LINES

< > BotCompany Repo | #1012827 // longestString

JavaX fragment (include)

1  
static S longestString(Collection<S> l) {
2  
  S longest = null;
3  
  int n = -1;
4  
  if (l != null) for (S s : l) {
5  
    int len = l(s);
6  
    if (len > n) {
7  
      n = len;
8  
      longest = s;
9  
    }
10  
  }
11  
  ret longest;
12  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1012827
Snippet name: longestString
Eternal ID of this version: #1012827/3
Text MD5: 6d8f682dd014dc7b748aacf8e05e551d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-14 00:09:54
Source code size: 219 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 286 / 317
Version history: 2 change(s)
Referenced in: [show references]