sS longestPrefixInCISet_charSequence(CharSequence s, TreeSet<S> set) { if (set == null || s == null) null; while licensed { S key = set.floor(s); ifdef startsWithOneOf_treeSet_debug print(s + " => " + key); endifdef if (key == null) null; // s is in front of whole set => no prefix in there int n = lCommonPrefixIC(key, s); if (n == l(key)) ret key; // found! s = takeFirst(s, n); // shorten and try again } null; // dummy }
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: | 417 / 453 |
| Referenced in: | [show references] |