private int findPublicSuffix() {
    final int partsSize = parts.size();

    for (int i = 0; i < partsSize; i++) {
      String ancestorName = DOT_JOINER.join(parts.subList(i, partsSize));

      if (PublicSuffixPatterns.EXACT.containsKey(ancestorName)) {
        return i;
      }

      // Excluded domains (e.g. !nhs.uk) use the next highest
      // domain as the effective public suffix (e.g. uk).

      if (PublicSuffixPatterns.EXCLUDED.containsKey(ancestorName)) {
        return i + 1;
      }

      if (matchesWildcardPublicSuffix(ancestorName)) {
        return i;
      }
    }

    return NO_PUBLIC_SUFFIX_FOUND;
  }
private int findPublicSuffix ( ) { final int partsSize = parts . size ( ) ; for ( int i = 0 ; i < partsSize ; i ++ ) { String ancestorName = DOT_JOINER . join ( parts . subList ( i , partsSize ) ) ; if ( PublicSuffixPatterns . EXACT . containsKey ( ancestorName ) ) { return i ; } if ( PublicSuffixPatterns . EXCLUDED . containsKey ( ancestorName ) ) { return i + 1 ; } if ( matchesWildcardPublicSuffix ( ancestorName ) ) { return i ; } } return NO_PUBLIC_SUFFIX_FOUND ; }
Returns the index of the leftmost part of the public suffix, or -1 if not found. Note that the
value defined as the "public suffix" may not be a public suffix according to
{@link #isPublicSuffix()} if the domain ends with an excluded domain pattern such as
{@code "nhs.uk"}.