code: public boolean equalsConsiderVariantsIfSpecified(Language otherLanguage) {
      if (getShortCode().equals(otherLanguage.getShortCode())) {
        boolean thisHasCountry = hasCountry();
        boolean otherHasCountry = otherLanguage.hasCountry();
        return !(thisHasCountry && otherHasCountry) ||
                getShortCodeWithCountryAndVariant().equals(otherLanguage.getShortCodeWithCountryAndVariant());
      } else {
        return false;
      }
    }
docs: Return true if this is the same language as the given one, considering country
  variants only if set for both languages. For example: en = en, en = en-GB, en-GB = en-GB,
  but en-US != en-GB
  @since 1.8