// return longest common prefix of s an an entry of set
static L longestCommonPrefixOfNavigableSetAndList(L s, NavigableSet> set, Comparator comparator) {
if (set == null || s == null) null;
L a = set.floor(s), b = set.higher(s);
int n1 = lCommonPrefix_lists_comparator(a, s, comparator);
int n2 = lCommonPrefix_lists_comparator(b, s, comparator);
int n = max(n1, n2);
ret takeFirst(s, n);
}