@ Override public String [ ] toStringArray ( ) { ArrayList < String > out = new ArrayList <> ( ) ; out . add ( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ) ; out . add ( "<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n" ) ; ArrayList < WebPage > values = new ArrayList <> ( urls . values ( ) ) ; Collections . sort ( values ) ; for ( WebPage webPage : values ) { out . add ( constructUrl ( webPage ) ) ; } out . add ( "</sitemapindex>" ) ; return out . toArray ( new String [ ] { } ) ; }
Construct sitemap to String array