1 | sS longestPrefixInCISet_charSequence(CharSequence s, TreeSet<S> set) {
|
2 | if (set == null || s == null) null; |
3 | while licensed {
|
4 | S key = set.floor(s); |
5 | ifdef startsWithOneOf_treeSet_debug |
6 | print(s + " => " + key); |
7 | endifdef |
8 | if (key == null) null; // s is in front of whole set => no prefix in there |
9 | int n = lCommonPrefixIC(key, s); |
10 | if (n == l(key)) ret key; // found! |
11 | s = takeFirst(s, n); // shorten and try again |
12 | } |
13 | null; // dummy |
14 | } |
Began life as a copy of #1027971
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: | #1028146 |
| Snippet name: | longestPrefixInCISet_charSequence [dev.] |
| Eternal ID of this version: | #1028146/1 |
| Text MD5: | 082cb68544cf537b250bc7a02bbbe7af |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-05-23 16:29:20 |
| Source code size: | 479 bytes / 14 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 466 / 492 |
| Referenced in: | [show references] |