code: @Override
      public String[] toStringArray() {
          // auto-detect additional namespaces
          List<AdditionalNamespace> additionalNamespaces = new ArrayList<>();
          boolean hasImages = urls.values().stream()
                  .anyMatch(webPage -> webPage.getImages() != null);
          if(hasImages) {
              additionalNamespaces.add(AdditionalNamespace.IMAGE);
          }
          boolean hasAlternateNames = urls.values().stream()
                  .anyMatch(webPage -> webPage.getAlternateNames() != null);
          if(hasAlternateNames) {
              additionalNamespaces.add(AdditionalNamespace.XHTML);
          }
  
          ArrayList<String> out = new ArrayList<>();
          out.add("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
          out.add("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"" + constructAdditionalNamespacesString(additionalNamespaces) + ">\n");
          ArrayList<WebPage> values = new ArrayList<>(urls.values());
          Collections.sort(values);
          for (WebPage webPage : values) {
              out.add("<url>\n");
              out.add(constructUrl(webPage));
              if (webPage.getImages() != null) {
                  for (Image image : webPage.getImages()) {
                      out.add(constructImage(image));
                  }
              }
              out.add("</url>\n");
          }
          out.add("</urlset>");
          return out.toArray(new String[]{});
      }
docs: Construct sitemap into array of Strings. The URLs will be ordered using
  priority in descending order (URLs with higher priority will be at the
  top).
  
  @return sitemap