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

7
LINES

< > BotCompany Repo | #1030165 // longestCommonPrefixOfCISetAndString

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

Transpiled version (2741L) is out of date.

1  
// return longest common prefix of s an an entry of set
2  
sS longestCommonPrefixOfCISetAndString(S s, NavigableSet<S> set) {
3  
  if (set == null || s == null) null;
4  
  S a = set.floor(s), b = set.higher(s);
5  
  int n = Math.max(lCommonPrefixCI(a, s), lCommonPrefixCI(b, s));
6  
  ret takeFirst_string(s, n);
7  
}

Author comment

Began life as a copy of #1030164

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1030165
Snippet name: longestCommonPrefixOfCISetAndString
Eternal ID of this version: #1030165/5
Text MD5: 69b54a5641bbf4ea81a35214580b8e17
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-12 10:50:00
Source code size: 305 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 184 / 288
Version history: 4 change(s)
Referenced in: [show references]