public static List getAncestorLocales()

in locales-utils/src/main/java/com/spotify/i18n/locales/utils/hierarchy/LocalesHierarchyUtils.java [76:89]


  public static List<ULocale> getAncestorLocales(final ULocale locale) {
    Preconditions.checkNotNull(locale);
    if (isSameLocale(locale, ULocale.ROOT)) {
      return List.of();
    }
    List<ULocale> ancestors = new ArrayList<>();
    Optional<ULocale> currentOpt = getParentLocale(locale);
    do {
      ULocale current = currentOpt.get();
      ancestors.add(current);
      currentOpt = getParentLocale(current);
    } while (currentOpt.isPresent());
    return ancestors;
  }