src/main/java/com/solostudios/omnivoxscraper/impl/utils/index/OmniPageIndex.java
/**
     * Loads and builds the indexes from a page.
     * <p>
     * Must be called before {@link #getServiceUrl} or {@link #getServiceUrls()}
     *
     * @param page The page from which to build the indexes.
     */
Loads and builds the indexes from a page.

Must be called before  #getServiceUrl or  #getServiceUrls()

@param page The page from which to build the indexes.
Loads and builds the indexes from a page . Must be called before #getServiceUrl or #getServiceUrls () @param page The page from which to build the indexes .
public void loadIndexes(HtmlPage page) {
        logger.debug("building initial service map");
        Map<String, URL> serviceMap = buildServiceMap(page);
        Optional<Map.Entry<String, URL>> randomEntry = serviceMap.entrySet().stream().findFirst();
        if (randomEntry.isEmpty())
            throw new IllegalStateException("The list of services was empty.");
        if (englishIndexes.containsValue(randomEntry.get().getKey())) {
            logger.debug("Remapping with english indexes.");
            buildServicesIndex(serviceMap, englishIndexes);
        } else if (frenchIndexes.containsValue(randomEntry.get().getKey())) {
            logger.debug("Remapping with french indexes.");
            buildServicesIndex(serviceMap, frenchIndexes);
        } else {
            throw new IllegalStateException("Could not find proper index for random key " + randomEntry.get().getKey());
        }
    }
public void loadIndexes ( HtmlPage page ) { logger . debug ( "building initial service map" ) ; Map < String , URL > serviceMap = buildServiceMap ( page ) ; Optional < Map . Entry < String , URL > > randomEntry = serviceMap . entrySet ( ) . stream ( ) . findFirst ( ) ; if ( randomEntry . isEmpty ( ) ) throw new IllegalStateException ( "The list of services was empty." ) ; if ( englishIndexes . containsValue ( randomEntry . get ( ) . getKey ( ) ) ) { logger . debug ( "Remapping with english indexes." ) ; buildServicesIndex ( serviceMap , englishIndexes ) ; } else if ( frenchIndexes . containsValue ( randomEntry . get ( ) . getKey ( ) ) ) { logger . debug ( "Remapping with french indexes." ) ; buildServicesIndex ( serviceMap , frenchIndexes ) ; } else { throw new IllegalStateException ( "Could not find proper index for random key " + randomEntry . get ( ) . getKey ( ) ) ; } }
Loads and builds the indexes from a page.
Loads and builds the indexes from a page .